开发者

ActiveSheet.Pictures.Insert doesnt work in Excel 2007

开发者 https://www.devze.com 2023-02-16 05:24 出处:网络
开发者_如何学GoActiveSheet.Pictures.Insert doesnt work with remote images in Excel 2007... anyone got an alternative method?

开发者_如何学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.

0

精彩评论

暂无评论...
验证码 换一张
取 消