Adding specific photo from folder in to worksheet.

Learn_VBA

New Member
Joined
Oct 9, 2017
Messages
25
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
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I'm guessing you are missing a backslash:

Code:
Pics_Path = "C:\ZonalCatchmentsPro\Data\Store Photos[COLOR=#ff0000][B]\[/B][/COLOR]"
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top