This is my first post please be gentle... I am trying to "import" pictures into an excel sheet.I have data in column B that i am adding at the end of a directory string in A1 and then adding the file extension in B1 to return the image. Formula is: =$A$1&A2&$B$1result is: \\inside\ProductImageLibrary\Images\10061.jpg I am then using this with ActiveSheet.Pictures.insert to insert the picture into my sheet. The issue i have is some of pictures have additional attributes in the file name. i.e. 49451_100.jpg I have tried to solve for this using wildcards and extensive google searching to no avail. Ultimate goal with this code would be to bring back the first file that contains the data. I don't know what the additional attributes will be, but I do know somewhere in the name there will be the data 49451 image files for 49451 are:49451_100.jpg 49451_359.jpg 49451_434.jpg etc etc so far this is the code I have.
Sub get_pics()
Application.ScreenUpdating = False
Dim row As Integer
Dim imgsrc As String, imgdest As String
col = 2
coldes = 3
rowdes = 2
For row = 2 To 181
imgsrc = Cells(row, col).Value
imgdst = Cells(rowdes, coldes).Value
On Error Resume Next
With ActiveSheet.Pictures.insert(imgsrc)
.Left = Cells(rowdes, coldes).Left
.Top = Cells(rowdes, coldes).Top
col = col
coldes = coldes
rowdes = rowdes + 1
End With
Next row
On Error GoTo 0
Application.ScreenUpdating = True
End Sub
Display More