K
Kevin
I need to create a several slideshows from 200+ pictures, and I need to
do it in PowerPoint.
Rather than inserting each one, I'd like to use VBA to automate the
process.
The file are named sequentially (i.e. Picture 001, Picture 002) and so
I was thinking I could just write some kind of a loop that creates a
new slide, inserts a picture from a given folder with a file name of
Picture %variable% where the variable is a number. Then I would have
it increment, and do it again for all of the pictures.
This is what I've got so far, but it doesn't work because it can't find
the files. I know they're there, so I must have done something wrong.
Any suggestions or help would be greatly appreciated!
Dim counter As Integer
counter = 0
While counter < 73
If counter < 10 Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\Documents
and Settings\Schultz_K\Desktop\Safety Town AM\Flood 00" & counter &
".jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0,
Top:=0, Width:=721, Height:=541).Select
ElseIf counter < 100 Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\Documents
and Settings\Schultz_K\Desktop\Safety Town AM\Flood 0" & counter &
".jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0,
Top:=0, Width:=721, Height:=541).Select
End If
Wend
Thanks!
- Kevin
do it in PowerPoint.
Rather than inserting each one, I'd like to use VBA to automate the
process.
The file are named sequentially (i.e. Picture 001, Picture 002) and so
I was thinking I could just write some kind of a loop that creates a
new slide, inserts a picture from a given folder with a file name of
Picture %variable% where the variable is a number. Then I would have
it increment, and do it again for all of the pictures.
This is what I've got so far, but it doesn't work because it can't find
the files. I know they're there, so I must have done something wrong.
Any suggestions or help would be greatly appreciated!
Dim counter As Integer
counter = 0
While counter < 73
If counter < 10 Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\Documents
and Settings\Schultz_K\Desktop\Safety Town AM\Flood 00" & counter &
".jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0,
Top:=0, Width:=721, Height:=541).Select
ElseIf counter < 100 Then
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\Documents
and Settings\Schultz_K\Desktop\Safety Town AM\Flood 0" & counter &
".jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0,
Top:=0, Width:=721, Height:=541).Select
End If
Wend
Thanks!
- Kevin