logo
search
VBA & Macro Problems

How to Insert Multiple Photos into PowerPoint with VBA

Maira MehtabMaira Mehtab Sep 22, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press Alt + F11 in PowerPoint to open the Visual Basic for Applications (VBA) editor.

2
Insert a New Module

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

3
Write or Paste the Macro Code

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).

4
Customize the Folder Path

Modify the folder path string in your VBA code to point to the exact directory on your computer where the photos are stored.

5
Run the Macro

Press F5 or click the 'Run' button on the toolbar to execute the script and automatically generate your slides.

Macro Security: You may need to adjust your Macro Security settings in the Trust Center to allow the script to run without being blocked.
Efficient Presentation Management

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. 1. Open WPS Presentation: Launch WPS Office and create a new blank presentation.
  2. 2. Access the Photo Album Feature: Go to the 'Insert' tab on the top ribbon and click on 'Photo Album'.
  3. 3. Select Your Photos: Click 'File/Disk' to browse your computer and select the multiple photos you want to insert.
  4. 4. Adjust the Layout: In the Album Layout section, choose '2 pictures' per slide and click 'Create' to instantly generate your presentation.
Built-in Photo Album feature for batch inserting images.Highly compatible with Microsoft PowerPoint (.pptx) formats.Lightweight software that runs smoothly even with hundreds of photos.User-friendly interface requires no coding or VBA knowledge.
microsoft office alternative - wps office

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.