logo
search
VBA & Macro Problems

How to Insert Multiple Photos into PowerPoint Using Custom Layouts via VBA

Huma Ashraf ChHuma Ashraf Ch Sep 28, 2026 870 views

Question details

The user wants to insert hundreds of photos into presentation slides with a custom layout, as the default Photo Album feature does not offer customizable positioning.

How to Insert Multiple Photos into PowerPoint Using Custom Layouts
Product
Microsoft PowerPoint
Device & OS
not provided
Scenario
Creating a presentation with a large batch of images that require specific sizing and placement, such as positioning two photos side-by-side on each slide.
Observed behavior
The built-in Photo Album feature only provides limited, fixed layouts. Users are forced to either accept these default layouts or manually resize and arrange every single image across all slides.
Before you start

Gather all the images you intend to use into a single local folder and make a backup copy of your PowerPoint presentation before writing or executing any VBA macros.

Solution 1Recommended

Automate Image Insertion and Layout using VBA Macros

Use a VBA script to loop through a folder of images, inserting them into slides while automatically calculating and assigning specific dimensions and coordinates.

By writing a custom VBA macro, you can bypass the default Photo Album restrictions. VBA allows you to explicitly define the Left, Top, Width, and Height properties for each picture you insert. This makes it possible to format hundreds of images exactly how you want them, such as placing two pictures side-by-side perfectly.

1
Open the VBA Editor

In PowerPoint, press 'Alt + F11' on your keyboard to open the Microsoft Visual Basic for Applications window.

2
Insert a New Module

Click on 'Insert' in the top menu and select 'Module' to create a blank script window for your presentation.

3
Add Custom VBA Code

Search for and paste a trusted VBA script for inserting multiple images (e.g., a 'two pictures per slide' macro). Update the folder path variable in the script to point to the folder containing your photos.

4
Configure Layout Dimensions

Within the VBA code, adjust the numerical values for the 'Left', 'Top', 'Width', and 'Height' parameters to dictate where each image will be placed on the slide.

5
Run the Macro

Press 'F5' to run the macro. PowerPoint will automatically process the images in your folder and place them on new slides according to your customized layout.

Automate Image Insertion and Layout using VBA Macros
Enable Macros: If the script doesn't execute, you may need to adjust your security settings. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and ensure macros are enabled for trusted documents.
Free Microsoft Office alternative

Create Stunning Presentations Effortlessly with WPS Office

If dealing with complex VBA coding in Microsoft PowerPoint is too frustrating or time-consuming, consider switching to WPS Office. It provides a lightweight, highly compatible alternative for creating beautiful presentations without the steep learning curve.

  1. 1. Download and Install: Visit the official WPS website to download and install the free WPS Office suite.
  2. 2. Open Your Presentation: Launch WPS Presentation and open your existing PPTX files directly.
  3. 3. Edit with Ease: Use the highly intuitive interface to quickly format your slides and insert images seamlessly.
Fully compatible with Microsoft PowerPoint (.pptx) formatsLightweight installation and incredibly fast loading timesIntuitive user interface for easy image formatting and alignmentRich library of free presentation templates and layouts
QA img-9

Frequently Asked Questions

Can I customize the default PowerPoint Photo Album layouts without using VBA?

No, the built-in Photo Album feature only provides a set of predefined layouts (such as 1, 2, or 4 pictures per slide). To achieve custom positioning and sizing automatically, using a VBA macro is required.

How do I find the correct Left and Top coordinates for my VBA macro?

You can manually insert an image onto a slide, drag it to your desired position, and resize it. Then, right-click the image, select 'Size and Position', and note down the exact dimensions and coordinates shown. You can plug these numerical values directly into your VBA code.

Why is my PowerPoint VBA macro not running when I press F5?

Your macro security settings might be preventing execution. Navigate to File > Options > Trust Center > Trust Center Settings > Macro Settings, and temporarily select 'Enable all macros'. Remember to only run code from trusted sources.

Is there a way to insert multiple photos into specific placeholders using VBA?

Yes, instead of using absolute coordinates (Left/Top), advanced VBA scripts can be written to loop through a custom slide layout, identify specific shape names or placeholder IDs, and insert the pictures directly into those predetermined placeholders.