open powerpoint file

R

raph_baril

I want to open a power point file with the following code but it's always
giving me an error on the last line. Somebody knows?

Sub openppt()

Dim Brocoli As Object
Dim Potato As Object
Dim carot As String

carot = "C:\random folder\open me.ppt"

Set Brocoli = CreateObject("powerpoint.Application")
Brocoli.Visible = True

Set Potato = Brocoli.documents.Open(Filename:=carot)

End Sub
 
C

Chip Pearson

The PowerPoint object model doesn't have a Documents object. Did
you just make it up? Try

Set Potato = Brocoli.Presentations.Open(filename:=carot)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




message
news:[email protected]...
 
R

raph_baril

Yes I made it up, it works perfectly when you replace "document" by
"presentations"
Thanks!!!
 

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