Link to home
Start Free TrialLog in
Avatar of John Smith
John SmithFlag for Australia

asked on

How can i call a picture from another directory and change the selection by changing the reference in cell "B2" of active sheet?

I would like to insert pictures in a spreadsheet using a picture reference number in a cell "B2" the pictures are located in file ("M:\Documents and Settings\Workoiece\Desktop\Filename"). The filename being the name of the picture eg. Pic214811.png
Can some assist by concatenating the number or value in Activesheet, cell ("B2") sample only ("214811") with "Pic" leading the number and then add ".png" for me to show that PicName = Pic214811.png then change line 2 to call up the picture from drive "M: etc.".  

Sub PlacePic_1()
'This macro insert Picture.

Dim PlacePic As String

‘PicName is made up from the concatenation of “Pic” and Picture Number “214811” plus file extension.
PicName = Pic214811.png

    Range("A1").Select
    ActiveSheet.Pictures.Insert("M:\ Documents and Settings\Workpiece\Desktop\(PicName)").Select
    Range("A9").Select
End Sub


Any assistence would be greatly appreciated. THANK YOU.
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Smith

ASKER

Thanks for the solution.

I removed lines 7 & 8 as recommended by you and that was the results I was hoping fore.
Before removing lines 7 & 8 the picture was reduced in sizes that was going to cause me some issues. So thanks for extra changes.

Many Thanks