Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically putting images into PowerPoint

Status
Not open for further replies.

cantwellt

Technical User
May 28, 2000
81
US
Is there a way to make PowerPoint create a new slide, fill the slide with an image, create a new slide, fill it with the next image and so on until all the images in the folder are used? Would it also be possible to have it insert a textbox with the filename of the image?

I'm not a VB person, but if someone could give me an idea on how to start, I have enough basic experience that I might be able to figure it out using help files.


We do a lot of PowerPoint presentations that start out with a lot of photos, and it becomes quite tedious after a hundred or so!

Thanks for any help in advance!

 
Give this a try. You will have to set a reference to the Microsoft Scripting Runtime library to use this code.

'Set Microsoft Scripting Runtime found under the
'Tools - References... Menu

Sub TestThis()
Dim FSO
Dim strFldr As String
Dim objFldr
Dim objFiles
Dim objFile
Set FSO = CreateObject("scripting.filesystemobject")
'Set path to your image folder
strFldr = "C:\My Documents\My Pictures\"
Set objFldr = FSO.GetFolder(strFldr)
Set objFiles = objFldr.Files
For Each objFile In objFiles
If objFile.Type Like "*Image" Then
With ActivePresentation
.Slides.Add .Slides.Count + 1, ppLayoutBlank
.Slides(.Slides.Count).Select
ActiveWindow.Selection.SlideRange.Shapes.AddPicture FileName:=objFile.Path, _
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=160, Top:=137, _
Width:=400, Height:=267
End With
End If
Next
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top