Hello addysdddy,
The following macro has been added to the attached workbook. It will load the picture file, if it exists, and display it below Cell "E13" in a Image control. This control will automatically size itself to the pictures dimensions. Currently, all the files searched for are ".jpg" extension. The macro automatically runs when the value in cell "F12" changes. Set the DirPath to where your picture files are located.
Sub ShowPicture()
Dim DirPath As String
Dim FileName As String
Dim Pic As StdPicture
DirPath = "C:\Documents and Settings\My Documents\My Pictures"
FileName = Worksheets("Sheet1").Range("F12")
FileName = DirPath & "\" & FileName & ".jpg"
If Dir(FileName) <> "" Then
Set Pic = LoadPicture(FileName)
With Worksheets("Sheet1").Image1
.Picture = Pic
.Height = Pic.Height / 25.4
.Width = Pic.Width / 25.4
End With
Else
MsgBox "The Picture File was not found -" & vbCrLf & FileName, vbExclamation
End If
End Sub
Sincerely,
Leith Ross
Bookmarks