将MFC里list表格内容输出到EXCEL,最后一列需要设置成超链接,从CSDN资源里下载了代码,由于代码不齐全,未调通,想问下这到底怎么设置?以下是网上下载的代码://建立超链接
CString cc; //超链接¨地址
cc =_T("http://www.baidu.com/index.php?tn=maxthon2&ch=3");//
range.AttachDispatch(sheet.GetRange(_variant_t(_T("C2")),_variant_t(_T("C2")))); //获得区域
links.AttachDispatch(range.GetHyperlinks()); //获得Hyperlinks对象
links.Add(range,cc,_variant_t(_T("")),_variant_t(_T("")),_variant_t(_T(""))); //设置超链接
CString cc; //超链接¨地址
cc =_T("http://www.baidu.com/index.php?tn=maxthon2&ch=3");//
range.AttachDispatch(sheet.GetRange(_variant_t(_T("C2")),_variant_t(_T("C2")))); //获得区域
links.AttachDispatch(range.GetHyperlinks()); //获得Hyperlinks对象
links.Add(range,cc,_variant_t(_T("")),_variant_t(_T("")),_variant_t(_T(""))); //设置超链接
sub hong1()
ActiveSheet.Hyperlinks.Add Anchor:=Selection,Address:=
"d:\work\0.jpg",_
TextToDisplay:=_
"d:\work\0.jpg",
Range("R17").SelectEnd Sub
下列VBA怎么转换成C++代码VBA的代码是:
sub hong1()
ActiveSheet.Hyperlinks.Add Anchor:=Selection,Address:=
"d:\work\0.jpg",_
TextToDisplay:=_
"d:\work\0.jpg",
Range("R17").SelectEnd Sub
With Worksheets(1)
.Hyperlinks.Add Anchor:=.Range("a5"), _
Address:="http://example.microsoft.com", _
ScreenTip:="Microsoft Web Site", _
TextToDisplay:="Microsoft"
End With
本示例向单元格 A5 中添加一个电子邮件超链接。
With Worksheets(1)
.Hyperlinks.Add Anchor:=.Range("a5"), _
Address:="mailto:[email protected]?subject=hello", _
ScreenTip:="Write us today", _
TextToDisplay:="Support"
End With