开发者_如何学GoActiveSheet.Pictures.Insert doesnt work with remote images in Excel 2007... anyone got an alternative method?
Public Sub InsertImages()
Dim iIndex As Integer
Dim sImageName As String
Dim sImageCell As String
For iIndex = 3 To 30
sImageName = "http://images.server.com" & ActiveSheet.Range("DV" + Trim(Str(iIndex))).Value
sImageCell = "DW" + Trim(Str(iIndex))
ActiveSheet.Pictures.Insert(sImageName).Select
With Selection.ShapeRange
.Top = Range(sImageCell).Top + 20
.Left = Range(sImageCell).Left + 20
.Height = Range(sImageCell).Height - 40
.Width = Range(sImageCell).Width - 40
End With
Next
End Sub
Looking at the code above, are you passing in correct url?
Does that url fetch an image (such as jpeg) when posted using a browser.
put Debug.Print sImageName
before ActiveSheet.Pictures.Insert(sImageName).Select
.
It seems the URL you are generating is incorrect.
精彩评论