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
- Launch Automator (usually found within your Applications folder)
- Go to File > New
- Select Service and click Choose (Note: in macOS Mojave and above, select the Quick Action option)
- In the top right hand of the window that appears, ensure that "No input" is selected from the Service receives drop-down list
- Ensure the In drop-down list is showing "Any application"
- In the second column containing the long list, find "Run AppleScript" and double-click on it
- This will add the Run AppleScript window on the right
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
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.