In article <EF2FF7C4-680C-4821-B8AC-(E-Mail Removed)>, Adam Milligan
wrote:
> 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
There's no ActivePresentation object in Access, hence the error.
Try this instead:
Pres.Slides.InsertFromFile sFile, 1
>
> recPowerPoint.MoveNext
>
> Loop
>
> ActivePresentation.SaveAs "c:/New.ppt"
And instead of that,
Pres.SaveAs etc ...
>
> 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
>
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:
www.pptfaq.com
PPTools:
www.pptools.com
================================================