我想在我的图片中添加一个webaddress作为超链接。我的代码是:
Public Sub insert_video_from_file(a As Worksheet)
...
hoehe = Application.CentimetersToPoints(4.96)
breite = Application.CentimetersToPoints(2)
a.Activate
'Set objPicture = InsertPicture("C:\Users\VEKO\Desktop\GPTW_logo.jpg", Cells(1, 1), strReturnMsg, hoehe, breite)
Set objPicture = InsertPicture(ThisWorkbook.Path & "\video.jpg", Cells(1, 1), strReturnMsg, hoehe, breite)
objPicture.Name = "video" 'Name vergeben
With a
.Hyperlinks.Add Anchor:=.Shapes.Name(objPicture.Name), Address:= "www.google.de"
End With
Set objPicture = Nothing
End Sub
我得到了一个超链接设置到图片,但超链接是"文件的路径" + www.google.de (e.g. C://User/Desctop/www.google.de)
。我检查了互联网,这些例子给了我相同的.hyperlinks.add锚码我用过,所以我不知道为什么路径设置。谁可以帮助我?
答案 0 :(得分:1)
HTTP://
是必需的,你的锚也是错的:
.Hyperlinks.Add Anchor:=objPicture, Address:= "http://www.google.de"