PowerPoint Macro for Mac - load pictures like "Insert Photo Album"

PowerPoint on the Mac doesn't have the Insert Photo Album functionality which allows you to select images and new PPT created with one image on each slide.

I have an old macro that does this on Windows---but Mac doesn't support Application.FileDialogue

How can I set this up to work on Mac?

Many thanks!

'This is the Windows code - won't work on Mac
Dim curSlide As Slide
Dim oPic As Shape
Dim Pres As Presentation
Dim picCount As Integer
Dim i As Integer
Dim fd As FileDialog

Set Pres = ActivePresentation


  'Add selected pictures from directory
   picCount = 1
   Set fd = Application.FileDialog(msoFileDialogFilePicker)
       With fd
           .Title = "Select image files and click OK"
           .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.bmp; *.tif; *.png"
           .FilterIndex = 2

           If .Show = -1 Then
             For i = 1 To .SelectedItems.Count

                Set curSlide = ActivePresentation.Slides.Add(ActivePresentation.Slides.Count + 1, ppLayoutBlank)
                Set oPic = curSlide.Shapes.AddPicture(FileName:=.SelectedItems(i), _
                    LinkToFile:=msoFalse, _
                    SaveWithDocument:=msoTrue, _
                    Left:=0, _
                    Top:=0, _
                    Width:=-1, _
                    Height:=-1)



         Next i

         End If

        End With

I would forget your VBA based macro from PowerPoint for Windows and instead create a macOS service that you can user whenever you want, including directly from PowerPoint. To do this you will need to use Automator to create a service that runs an Apple Script.

Create a service using Automator

  1. Launch Automator (usually found within your Applications folder)
  2. Go to File > New
  3. Select Service and click Choose (Note: in macOS Mojave and above, select the Quick Action option)
  4. In the top right hand of the window that appears, ensure that "No input" is selected from the Service receives drop-down list
  5. Ensure the In drop-down list is showing "Any application"
  6. In the second column containing the long list, find "Run AppleScript" and double-click on it
  7. This will add the Run AppleScript window on the right
  8. Now, replace the (* Your script goes here *) with the following script1:

    tell application "Finder" to set frontmost to true
    tell application "Finder" to set picFolder to every file in folder (choose folder)
    log (count picFolder)
    
    tell application "Microsoft PowerPoint"
        activate
        set newPres to make new presentation
        --set properties of slide 1 of active presentation to {layout:slide layout blank}
        set theSlide to make new slide at end of newPres with properties {layout:slide layout blank}
        repeat with xName in picFolder
            make new picture at end of last slide of active presentation with properties {file name:(xName as text), top:0, left position:0, height:541, width:722, lock aspect ratio:true} --makes pictures full sized
            make new slide at end of active presentation with properties {layout:slide layout blank}
        end repeat
    end tell
    
  9. Save the service using a meaningful name (e.g. Create PP Photo Album).

Now you should be able to run the service from any application, not just from within PowerPoint. You can do this by going to the Services list within any Application menu (e.g. PowerPoint > Services, Finder > Services, Safari > Services, TextEdit > Services, etc) and select the service you just created.

Notes:

  • When it runs, it'll open a Finder window asking you to select the folder containing your pictures. Once selected click on the Choose button. PowerPoint will then open a new blank presentation and insert all of the pictures in the selected folder into their own slide.
  • PowerPoint does not need to be already open when you run the service, but it will run quicker if it is.
  • You can also choose to create a keyboard shortcut to automatically run the Service for you. You can do this from Apple > System Preferences > Keyboard - just select the Shortcuts tab, pick Services from the lefthand side and choose the Service you created from the righthand side.

1. This is an old script I adapted from one I found on the web some years ago for use with MS Office 2011. I do not recall offhand from where I obtained the original script, but I can vouch for the fact it still works with the latest version of MS PowerPoint.