R
RandomStu
I have an Excel sheet with vba code that grabs an image from the
internet and inserts it onto the sheet. For example, there's an image
of clothing at
http://www.gap.com/resources/productImage/v1/770868002/P01
(which I can see when I paste the URL into my browser bar). To insert
the image into my workbook, I use code like this:
Sub AddImage()
Dim thePix As Shape
Dim imageURL As String
Dim wks As Worksheet
Dim pasteBelowCell As Range
Set wks = ThisWorkbook.Sheets(1)
Set pasteBelowCell = wks.Range("D8")
imageURL = "http://www.gap.com/resources/productImage/v1/770868002/
P01"
For Each thePix In wks.Shapes
thePix.Delete
Next thePix
Set thePix = wks.Shapes.AddShape(msoShapeRectangle,
pasteBelowCell.Offset(2).Left, _
pasteBelowCell.Offset(2).Top, 120, 140)
Application.DisplayAlerts = False
On Error Resume Next
thePix.Fill.UserPicture imageURL
On Error GoTo 0
Application.DisplayAlerts = True
End Sub
This works beautifully for me. It also works fine pulling in a
different image if I substitute a Canadian URL in the code:
http://www.gapcanada.ca/resources/productImage/v1/848945003/P01
However, when I pass the Excel file to someone in a different network,
they find it works for the US URL, but not the Canadian one. When they
run the code with the gapcanada URL, they get a rectangle with no
image inside.
Please give me any hint of what could be going on.
Many thanks in advance.
(e-mail address removed)
internet and inserts it onto the sheet. For example, there's an image
of clothing at
http://www.gap.com/resources/productImage/v1/770868002/P01
(which I can see when I paste the URL into my browser bar). To insert
the image into my workbook, I use code like this:
Sub AddImage()
Dim thePix As Shape
Dim imageURL As String
Dim wks As Worksheet
Dim pasteBelowCell As Range
Set wks = ThisWorkbook.Sheets(1)
Set pasteBelowCell = wks.Range("D8")
imageURL = "http://www.gap.com/resources/productImage/v1/770868002/
P01"
For Each thePix In wks.Shapes
thePix.Delete
Next thePix
Set thePix = wks.Shapes.AddShape(msoShapeRectangle,
pasteBelowCell.Offset(2).Left, _
pasteBelowCell.Offset(2).Top, 120, 140)
Application.DisplayAlerts = False
On Error Resume Next
thePix.Fill.UserPicture imageURL
On Error GoTo 0
Application.DisplayAlerts = True
End Sub
This works beautifully for me. It also works fine pulling in a
different image if I substitute a Canadian URL in the code:
http://www.gapcanada.ca/resources/productImage/v1/848945003/P01
However, when I pass the Excel file to someone in a different network,
they find it works for the US URL, but not the Canadian one. When they
run the code with the gapcanada URL, they get a rectangle with no
image inside.
Please give me any hint of what could be going on.
Many thanks in advance.
(e-mail address removed)