Insert multiple images at once from a folder based on name from another column

navic

Active Member
Joined
Jun 14, 2015
Messages
346
Office Version
  1. 2013
Platform
  1. Windows
I have tried several VBA macros from the Internet, but I have not found a solution.

Folder C:\Temp\ contains images (about 1500 files, different width and height. All files are named different format name)
example: 1.jpg, 2.jpg, 3.jpg, 4.jpg, 4A.jpg, 5blok.jpg .... .etc to 1500.jpg

In the column "D" I have a image name
example:
D2 = 10
D3 = 7blok
D8 = 25
etc.

I want into cells B2, B3, B8, etc. insert images based on image name in column "D". (Only in the row containing the image name in the "D". If a cell in column D is empty, then the cells in the same row in column B should be empty)

My problem is the following:
- After starting the VBA Excel should insert images into column "B" based on their names in column "D" (but only to the row that contains the image name in the "D")
- Some images are dimensions: 154x75, 272x104, 96x150, 150x118 etc. I want to VBA all images that are wider than 100 pix reduced to 100 pixels, and the images that are less than 100 pix leave the respective width. I want set maximum image width is 100 pix (width of column B). The images height should be adjusted (adapt) to a given width. So, should keep the ratio width/height
- Finally, in each row in which the inserted picture Excel should adjust (adapt) the height row for that picture.
- When I delete files in the Temp folder, Excel needs to keep all of the images inside Workbook

I hope you understand. If you need, I will be further clarified.
Note! I use non-US Excel settings

Can someone help?
 
Hi Tonyyy,

I wanted the same utility and your code worked up just fine. Thanks for that.

But one problem. The images are placed so corner to corner that the border lines are invisible. I figured out to size from right and bottom side but can we set the top and left placement within the cell.

Thanks
SAM
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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