Inserting multiple pictures on multiple Powerpoint slides

M

Mengoxon

Hi,

this has been a topic of discussion many times before (but
unfortunately on Google Groups you cannot reply later than a month -
why doesn't Google start a real tech support forum?).

How do I insert a folder full of pictures into a PowerPoint
presentation, where each picture gets its own slide?

Searching the Internet, I found the following Visual Basic script:

Sub ImportABunch()

Dim strTemp as String
Dim strFileSpec as String
Dim oSld as Slide
Dim oPic as Shape

strFileSpec = "Give it a complete mac or PC style file path here"
' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"

strTemp = Dir(strFileSpec)

Do While strTemp <> ""
Set oSld = ActivePresentation.Slides.Add(ActivePresentation.Slides.Count
+ 1, ppLayoutBlank)
Set oPic = ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=strFileSpec,
_
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, _
Top:=0, _
Width:=100, _
Height:=100)

' Reset it to its "real" size
With oPic
.ScaleHeight 1, msoTrue
.ScaleWidth 1, msoTrue
End With

' and optionally, make it fill the slide - to do that, uncomment the
following:
' With oPic
' .Height = ActivePresentation.PageSetup.SlideHeight
' .Width = ActivePresentation.PageSetup. SlideWidth
' End n

' Get the next file that meets the spec and go round again
strTemp = Dir
Loop

End Sub

Search terms:
Batch Insert a folder full of pictures, one per slide
http://www.rdpslides.com/pptfaq/FAQ00352.htm

But modifying this for a Mac, I could not make it run. A file path
such as:

' Ex. on a PC: "C:\My Pictures\Flowers\*.PNG"

would read as follows in Mac-ese:

"Macintosh HD:Users:john:Desktop:Images:"

Visual Basic on Mac does not support the wild card with asterisk (*),
presumably because Mac OS 9 did not support it. So I have to use the
MacID function (see Powerpoint Help for instruction). I presume that
the MacID for a JPEG file is MacID("JPEG") but I do not know for sure.
So I tried these combinations but it did not seem to work - nothing
happens. If I specify a specific file, it inserts that one picture, so
that part of the script is fine.

Does anybody know how to make this work?
 
S

Steve Rindsberg

VBA help has a habit of breaking when more than one version of PPT's installed,
so I can't get it to arf up anything useful here, but see if a look at
FileSearch gets you closer. Mac VBA used to use a slightly different statement
(FileFind? FindFile?) but the idea was about the same.
 
J

Jim Gordon MVP

Hi

I was able to make it work and wrote an add-in (it's not free). It's based
on the sample code you found.
http://www.agentjim.com/MVP/PowerPoint/ppt.html

I used the FindFile method to loop through the file list. But it only works
in PowerPoint 2001. PPT version X does not support FindFile (even if the
documentation says it does). Hopefully Microsoft will fix it for Office
2004.

Here's the code sample from PowerPoint help:

Using the FileFind Object
Use the FileFind property to return the FileFind object.
The following example displays a count of all the files in the My Documents
folder created between 5/5/98 and 7/10/98.
With Application.FileFind
.Options = msoOptionsNew
.SearchPath = "Macintosh HD:My Documents"
.DateCreatedFrom = "5/5/98"
.DateCreatedTo = "7/10/98"
.Execute
MsgBox .FoundFiles.Count & " files found."
End With

The sample code you have for resizing may need some additional modifications
to account for pictures of various aspect ratios.

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.


----------
 
S

Steve Rindsberg

I used the FindFile method to loop through the file list. But it only works
in PowerPoint 2001. PPT version X does not support FindFile (even if the
documentation says it does).

Finally! Fair and equal treatment for Mac users. They broke FileSearch (the
equivalent) in Office 2002 also.

Do we laugh now, or do we cry?
 
J

Jim Gordon MVP

The Microsoft Mac Business Unit listens closely to customer feedback. That
makes me very hopeful that the next Mac version of PowerPoint will have a
fix.

-Jim Gordon
Mac MVP

All responses should be made to this newsgroup within the same thread.
Thanks.

About Microsoft MVPs:
http://www.mvps.org/

Before posting a "new" topic please be sure to search Google Groups to see
if your question has already been answered.
 
S

Steve Rindsberg

The Microsoft Mac Business Unit listens closely to customer feedback. That
makes me very hopeful that the next Mac version of PowerPoint will have a
fix.

And if the Winfolks are really nice, maybe MBU will share. <g>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top