PDA

View Full Version : [SOLVED:] How to get URLS in excel as images for each row?



barrylaurell
07-07-2017, 05:08 AM
In J1 onwards I have a list of URLS. The following script does work except it doesn’t place the images for each URL where the links are. Any help? Thanks.



Sub InstallPictures()
Dim i As Long, v As String
On Error Resume Next
For i = 1 To 1903
v = Cells(i, "J").Value
If v = "" Then Exit Sub
With ActiveSheet.Pictures
.insert (v)
End With
Next i
On Error GoTo 0
End Sub

mdmackillop
07-07-2017, 08:24 AM
Sub InstallPictures()
Dim i As Long, v As String, Pic
On Error Resume Next
For i = 1 To 1903
v = Cells(i, "J").Value
If v = "" Then Exit Sub
Set Pic = ActiveSheet.Pictures.Insert(v)
With Pic
.Left = Cells(i, "J").Left
.Top = Cells(i, "J").Top
End With
Next i
On Error GoTo 0
End Sub

barrylaurell
07-07-2017, 04:58 PM
Thank you. That worked perfectly.

Logit
07-08-2017, 03:50 PM
.
barrylaurell (http://www.vbaexpress.com/forum/member.php?64394-barrylaurell)

I read your post and find it intriguing. I have a few scripts that "write or paste" URL to a cell or range but I'm not certain about the image ?

Can you explain what it is that you are pasting adjacent to the URL ? What kind of image ? Where does the image come from ? Etc.

Curious.


Thank you !

barrylaurell
07-08-2017, 08:59 PM
I'm not really sure what you're asking. Could you explain it in simpler terms sorry.

So say you have links in Column A:A9. You could adjust the VBA to create an image for each row and the links will be present too. IF you wanted to be really clever. You could add hyperlinks to the images and remove the URLS in excel for neatness. You could also perhaps add in to the VBA to edit the columns/rows so that they are exactly inline with the image. I'm not entirely sure how all this would be done but I'm sure it would not require too much to be added to this. I may ask this as a question if I am unable to work out how to do it in the future.

Logit
07-09-2017, 12:00 AM
.
How does the image relate to the URL ? Is this akin to an inventory catalog ? As a customer might review to not only see the item specs/pricing but also a sample image of the item ?