How to Insert Multiple Photos into PowerPoint with VBA
Question details
The user wants to automate the creation of slides by inserting hundreds of photos in a custom layout, specifically placing two images per slide.
- Product
- PowerPoint
- Device & OS
- not provided
- Scenario
- Automating the insertion and formatting of hundreds of photos into a presentation using code.
- Observed behavior
- The user needs a VBA macro method to insert images and define specific size and position attributes (width, height, left, and top) for a two-pictures-per-slide layout.
Ensure all the photos you want to insert are saved in a single local folder on your computer, and verify that the Developer tab is enabled in your PowerPoint ribbon to access the VBA editor.
Use a VBA Macro to Insert and Arrange Multiple Photos
Use a custom VBA macro to automatically loop through a folder of images and place two photos per slide with precise sizing and positioning.
Using VBA allows you to define exact parameters such as width, height, top, and left positions for each image. This eliminates the need for manual dragging and resizing when dealing with hundreds of pictures.
Press Alt + F11 in PowerPoint to open the Visual Basic for Applications (VBA) editor.
Click on 'Insert' in the top menu and select 'Module' to create a blank script window.
Paste a VBA script designed for '2 pictures per slide'. You will need to use the Shapes.AddPicture method and specify the file path, LinkToFile, SaveWithDocument, and position coordinates (Left, Top, Width, Height).
Modify the folder path string in your VBA code to point to the exact directory on your computer where the photos are stored.
Press F5 or click the 'Run' button on the toolbar to execute the script and automatically generate your slides.
Batch Insert Photos Easily with WPS Presentation
WPS Presentation offers a built-in feature to create photo albums instantly without needing complex VBA code. It provides an intuitive interface to insert multiple images and adjust layouts in seconds.
- 1. Open WPS Presentation: Launch WPS Office and create a new blank presentation.
- 2. Access the Photo Album Feature: Go to the 'Insert' tab on the top ribbon and click on 'Photo Album'.
- 3. Select Your Photos: Click 'File/Disk' to browse your computer and select the multiple photos you want to insert.
- 4. Adjust the Layout: In the Album Layout section, choose '2 pictures' per slide and click 'Create' to instantly generate your presentation.

Frequently Asked Questions
How do I enable the Developer tab to use VBA in PowerPoint?
Go to File > Options > Customize Ribbon. In the right pane under Main Tabs, check the box next to 'Developer' and click OK. The Developer tab will now appear on your ribbon.
Can I adjust the picture dimensions dynamically using VBA?
Yes, you can use variables in your VBA script to calculate and assign specific values to the .Width and .Height properties of the shape object based on the total slide size.
Why is my VBA macro not finding my images?
Ensure the folder path specified in your code is strictly correct, ends with a backslash (e.g., 'C:\Photos\'), and that the image file extensions match those defined in your Dir() function call.




