Hello,
i am currently trying to adapt Rikrak's formula below so that it will point to a certain folder on a hard drive. Can anyone advise how to do this please?
Currently i can only get this formula to add images when they are in the location of C:\
Try this, it will insert specified images in column C.
Assuming:
Column A = imagename (AL-100Y)
Column B = imagepath (c:vonnieimages)
Column C = place to insert image
Image extension can be jpg or gif
Sub InsertPictures()
Dim row As Long
Dim picPath As String
Dim Picture As Object
row = 1
On Error Resume Next
While Cells(row, 1) <> ""
Cells(row, 3).Select
' just guess what type of picture it is: .jpg or .gif
picPath = Cells(row, 2) & Cells(row, 1) & ".gif"
ActiveSheet.Pictures.Insert(picPath).Select
picPath = Cells(row, 2) & Cells(row, 1) & ".jpg"
ActiveSheet.Pictures.Insert(picPath).Select
Set Picture = Selection
'set cell height to picture size
Picture.Top = Picture.TopLeftCell.Top
Picture.Left = Picture.TopLeftCell.Left
Picture.TopLeftCell.EntireRow.RowHeight = Picture.Height
row = row + 1
Wend
End Sub
</PRE>
i am currently trying to adapt Rikrak's formula below so that it will point to a certain folder on a hard drive. Can anyone advise how to do this please?
Currently i can only get this formula to add images when they are in the location of C:\
Try this, it will insert specified images in column C.
Assuming:
Column A = imagename (AL-100Y)
Column B = imagepath (c:vonnieimages)
Column C = place to insert image
Image extension can be jpg or gif
Sub InsertPictures()
Dim row As Long
Dim picPath As String
Dim Picture As Object
row = 1
On Error Resume Next
While Cells(row, 1) <> ""
Cells(row, 3).Select
' just guess what type of picture it is: .jpg or .gif
picPath = Cells(row, 2) & Cells(row, 1) & ".gif"
ActiveSheet.Pictures.Insert(picPath).Select
picPath = Cells(row, 2) & Cells(row, 1) & ".jpg"
ActiveSheet.Pictures.Insert(picPath).Select
Set Picture = Selection
'set cell height to picture size
Picture.Top = Picture.TopLeftCell.Top
Picture.Left = Picture.TopLeftCell.Left
Picture.TopLeftCell.EntireRow.RowHeight = Picture.Height
row = row + 1
Wend
End Sub
</PRE>