The following code doesn't work for me. The code seems to fail on the last line. Do I have the correct syntax for inserting a photo in to a worksheet? The name of the photo should match the ANACode.
Sub Photo_Selector_Change()
Dim IA As Workbook:
Dim ES As Worksheet
Dim InputSheet As Worksheet
Dim Pics_Path As Variant
Dim PHOTO As String
Dim ANACode As String
Dim PhotoCell As Range
Set IA = ThisWorkbook
Set ES = IA.Sheets("Executive Summary")
Set InputSheet = IA.Sheets("Input Sheet")
Set Competitor = InputSheet.Range("B2")
Set PhotoCell = ES.Range("C30")
ANACode = Right(InputSheet.Range("B15"), 9)
MsgBox ANACode
Application.ScreenUpdating = False
Pics_Path = "C:\ZonalCatchmentsPro\Data\Store Photos"
PHOTO = ANACode
ES.Activate
ES.Shapes.AddPicture(Pics_Path & PHOTO & ".jpg", False, True, 470, 52, (301 * 1.7), 425).Name = "Photo"
End Sub
Sub Photo_Selector_Change()
Dim IA As Workbook:
Dim ES As Worksheet
Dim InputSheet As Worksheet
Dim Pics_Path As Variant
Dim PHOTO As String
Dim ANACode As String
Dim PhotoCell As Range
Set IA = ThisWorkbook
Set ES = IA.Sheets("Executive Summary")
Set InputSheet = IA.Sheets("Input Sheet")
Set Competitor = InputSheet.Range("B2")
Set PhotoCell = ES.Range("C30")
ANACode = Right(InputSheet.Range("B15"), 9)
MsgBox ANACode
Application.ScreenUpdating = False
Pics_Path = "C:\ZonalCatchmentsPro\Data\Store Photos"
PHOTO = ANACode
ES.Activate
ES.Shapes.AddPicture(Pics_Path & PHOTO & ".jpg", False, True, 470, 52, (301 * 1.7), 425).Name = "Photo"
End Sub