Inserting Pictures from a folder location built from 3 cells

ritna

New Member
Joined
Jun 28, 2017
Messages
4
Mr. Excel

I am looking for a macro to insert all of the pictures from a folder who's address is derived from multiple cells.

Picture location is as follows:
S:\Quality\QA\Warranty Photos 2017\ "cell N4" \ "cell K4" \ "merged cells J3 and K3"

All files in that folder will be ".jpeg"

Image currently follow no set pattern but if it needs to it can be done.
If so lets call them "p1", "p2", "p3" . . . "p7" (no more than 7 photos would be needed)

Image insertion location could be cell "V4" but doesn't really matter
(if multiple locations needed for multiple cells then just increase cell number i.e. "V5", "V6", "V7" ect)

No image modifications need to be done.

Is this even possible?

Any input is greatly appreciated
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
also, these cells are auto filled from a different worksheet via an entry into a different cell on the original worksheet (grabbing values from a master register to build individual reports).
This means the cells listed above would be "#N/A" until a value is entered into "merged cells J3 and K3"
 
Upvote 0
perhaps something like this


Code:
Sub Picture()
Dim first As String
Dim second As String
Dim third As String


first = Range("N4").Value
second = Range("K4").Value
third = Range("J3").Value & Range("K3").Value


ActiveSheet.Pictures.Insert("[COLOR=#333333]S:\Quality\QA\Warranty Photos 2017[/COLOR]\" & first & "\" & second & "\" & third & ".jpg").Select
End Sub
 
Upvote 0
Gave a error number 400

perhaps something like this


Code:
Sub Picture()
Dim first As String
Dim second As String
Dim third As String


first = Range("N4").Value
second = Range("K4").Value
third = Range("J3").Value & Range("K3").Value


ActiveSheet.Pictures.Insert("[COLOR=#333333]S:\Quality\QA\Warranty Photos 2017[/COLOR]\" & first & "\" & second & "\" & third & ".jpg").Select
End Sub
 
Upvote 0
hmmm maybe its erroring out because i didnt add the placement of the image.... try this now, i simply added the red portion

Code:
Sub Picture()
Dim first As String
Dim second As String
Dim third As String




first = Range("N4").Value
second = Range("K4").Value
third = Range("J3").Value & Range("K3").Value


[B][COLOR=#ff0000]Range("V4").Select[/COLOR][/B]
ActiveSheet.Pictures.Insert("S:\Quality\QA\Warranty Photos 2017\" & first & "\" & second & "\" & third & ".jpg").Select
End Sub
 
Upvote 0
The only reason i could think of that this would be wrong is the path you specified isnt correct... try taking a look at that

plus make sure the image you want is a .jpg

I tested it and it works fine
 
Last edited:
Upvote 0
so I think whats happening is the value in cell J3 (that you label as "third") isn't a picture file, it is folder in which multiple pictures of various naming conventions are kept (I think your code is trying to insert a picture with a name constructed as "third".jpg from the folder called "second"). Since a strict naming convention stops at the "third" folder level I was looking for a way to dump all the photos in a folder into a worksheet.
 
Upvote 0

Forum statistics

Threads
1,214,574
Messages
6,120,329
Members
448,956
Latest member
Adamsxl

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