A
Adam Milligan
All-
I am designing an application in Access 2003. What I woul dlike to do
through VBA is open a new, blank powerpoint presentation, add slides to the
presentation from four or five saved presentations and save the new
prentation. I already have the code that will loop through the filepaths of
the presentations I want to add, and I think I have opend up a new
presentation. Here is the code I have
Dim ppt As PowerPoint.Application
Dim pres As PowerPoint.Presentation
Set ppt = CreateObject("PowerPoint.Application")
Set pres = ppt.Presentations.Add
Do While recPowerPoint.EOF = False 'recPowerPoint is a recordset with the
file names I want to add
sFile = sFilePath & recPowerPoint("strTitle") & ".ppt" 'sFilePath is a user
defined variable for wherever they want to save the ppt files
ActivePresentation.Slides.InsertFromFile sFile, 1 'This is where I am
getting the error
recPowerPoint.MoveNext
Loop
ActivePresentation.SaveAs "c:/New.ppt"
Like I said, I get an error "ActiveX component can't create object" On the
ActivePresntation.Slides.InsertFromFile part of the code. I am new to
PowerPoint VBA nad any help would be appreciated. Thanks
Adam
I am designing an application in Access 2003. What I woul dlike to do
through VBA is open a new, blank powerpoint presentation, add slides to the
presentation from four or five saved presentations and save the new
prentation. I already have the code that will loop through the filepaths of
the presentations I want to add, and I think I have opend up a new
presentation. Here is the code I have
Dim ppt As PowerPoint.Application
Dim pres As PowerPoint.Presentation
Set ppt = CreateObject("PowerPoint.Application")
Set pres = ppt.Presentations.Add
Do While recPowerPoint.EOF = False 'recPowerPoint is a recordset with the
file names I want to add
sFile = sFilePath & recPowerPoint("strTitle") & ".ppt" 'sFilePath is a user
defined variable for wherever they want to save the ppt files
ActivePresentation.Slides.InsertFromFile sFile, 1 'This is where I am
getting the error
recPowerPoint.MoveNext
Loop
ActivePresentation.SaveAs "c:/New.ppt"
Like I said, I get an error "ActiveX component can't create object" On the
ActivePresntation.Slides.InsertFromFile part of the code. I am new to
PowerPoint VBA nad any help would be appreciated. Thanks
Adam