我正在尝试从位于工作簿单元格中的URL填充图像对象。我确实读过标签对象也可以用图片填充,但没有关于使用URL。在Cell N1中,我有一个链接到互联网上的图片。我希望Image Object使用位于N1的链接。目前我有一个按钮可以在浏览器中打开URL,但是客户端(我的妻子)宁愿在图像对象或标签对象中打开它。以下是我目前的情况。
Private Sub btnPicture_Click()
If Me.cmbInvID <> "" Then
Me.btnPicture.Visible = True
End If
'loop thru ws to find current item
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("Inventory")
wsLR = ws.Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To wsLR
If ws.Cells(x, 1) = Me.cmbInvID And Me.tbURL <> "" Then
currentrow = x
'get item
Me.tbURL = ws.Cells(x, "N")
ActiveWorkbook.FollowHyperlink Me.tbURL
Exit Sub
ElseIf ws.Cells(x, 1) = Me.cmbInvID And Me.tbURL = "" Then
currentrow = x
'Set message box
MsgBox "No Picture Available"
Exit Sub
End If
Next x
'This is the actual link that I am following for this example
'ActiveWorkbook.FollowHyperlink "https://www.facebook.com/VariousStyleShop/photos/a.513162572116670.1073741865.314715208628075/606029979496595/?type=3&theater"
End Sub
答案 0 :(得分:0)
您的网址不是图片,而是指向Facebook网站上脚本的链接。在获得实际图像*.jpg
,*.png
等
我敢打赌,如果你从Google / imagur / 500pix /等中抽取一些以.jpg
结尾的随机图像,那么你所得到的就会很好。