Powerpoint - Newbie Question

I would like to automate the insertion a set of .jpg images from a common folder in Powerpoint each on a separate slide. Can applescript do this and if so any help would be appreciated. There is a pc progrram called powerpoint importer that does this on the pc version, but cannot find a similar program for Macs.

How well do you know Visual Basic?

PowerPoint’s AppleScript Dictionary seems limited to:

do Visual Basic string

which basically means that whatever you can do in Visual Basic, you can do through AppleScript, but there isn’t a direct AppleScript way of doing it.

Not very familiar. Is this also available in Office v.X

Office v.X is what I’m using here. I don’t know if previous versions had any better or worse (if possible) AppleScript support.


Do not know how to use visual basic. I guess that I will have to do some research.

I’m also doing some research on visual basic.
I’ve made a macro in powerpoint called PrintGray
This workes fine with document I’ve made it in.
But it has to be open. The macro is stored in the document itself.

So the applescript below works fine, only if this document is open end only on this document.

tell application “Microsoft PowerPoint”
do Visual Basic “PrintGray”
end tell

How can I use the macro for any document either with VB or with Applescript?

Powerpoint doesn’t allow you to create a NORMAL document that contains the macro (as you can in in Word). Therefore, you cannot run the macro unless it is the document in question.

The Powerpoint object library doesn’t allow you to use statements such as:

    Application.Run MacroName:="MacroName"

You “might” be able to write an additional MACRO that copies the contents of one macro and moves them to each document, but I don’t know if that is what you want.

I have the same problem. There’s a commercial solution for Mac at:


But there’s no try-out, so I am reluctant to buy without try (it’s 30 bucks, 10 academic).

This commercial solution is based on this Visual Basic script:


But I could not make it work, since I know very little about Visual Basic and there is extremely few resources about Visual Basic on Mac on the Internet. One place of help is


and the PowerPoint help. In adapting the rdpslides script, remember that instead of the Windows wild card asterisk (*), you need to use MacID (find out more in PowerPoint Visual Basic help file) and instead of the backslash (), you need to use colon (:). I posted a request on this in the Mac Powerpoint Google Groups, if you find a solution, please let me know.

I’m not much of a VBA person but from the little bit I gleaned from that code, this should work. Open a new PP document but don’t add any slides (if you’re prompted to add the first slide, just hit the “cancel” button). Next, run this script:

set the_folder to (choose folder) as string
set the_files to list folder the_folder

tell application "Microsoft PowerPoint"
	repeat with i from 1 to (count of the_files)
		do Visual Basic "
Dim FullPath As String
FullPath = \"\" & the_folder & item i of the_files & \"\"

With ActivePresentation.Slides
    .Add .Count + 1, ppLayoutBlank
End With

Set myDocument = ActivePresentation.Slides(" & i & ")
myDocument.Shapes.AddPicture FullPath, False, True, 20, 20, 680, 500
	end repeat
end tell

This will prompt you to choose a folder full of images (please make sure only images are in the folder) and then it will make a new slide for every image importing the image to the slide at a default size & position (size=680x500, position={20,20}). You can adjust those parameters for linking and setting the position & size of the image. You could even script Image Events to get the actual size first and then use that info to add the image as large as can be to proportionately fit on the slide on an image by image basis. Again, this is a very quick script without much knowledge of VBA but it should get you going. Actually, I’m sure there are VBA commands for importing an image and setting it as proportionately large as possible but I tend to find things easier in AS than VBA.



Thanks a lot! This script already saved me half an hour. It works!

I also just found out in Google Groups that the Visual Basic script does not work because what is needed is a command FileFind and that command does not work in Office X due to a bug. More evidence that time invested in AppleScript is more worthwhile than time invested in Visual Basic…

BTW: Is it possible to keep the original image size?

I need to create a new power point file through apple script. I need to be able to save , add slides, pictures etc.
Do I need to have additional libraries or so?
Please let me know.
Thanks in advance