How to open an existing powerpoint file?
DOes anybody know how to open an existing powerpoint presentation?
Below are my current codes:
VB Code:
Private Sub cmdOpenFile_Click()
CommonDialog2.InitDir = "C:\"
CommonDialog2.ShowOpen
If CommonDialog2.FileName = "" Then
MsgBox "No file is opened", vbInformation, "Open File"
Else
Set ppApp = New PowerPoint.Application
Set ppPresent = ppApp.Presentations.Open(CommonDialog2.FileName, msoCTrue, msoCTrue, msoCTrue)
ppApp.Visible = msoTrue
End If
End Sub
I get an error of:
Quote:
Presentation(unknown member) : Invalid request. The Powerpoint Frame window does not exist.
The debugging line is at
Quote:
Set ppPresent = ppApp.Presentations.Open(CommonDialog2.FileName, msoCTrue, msoCTrue, msoCTrue)
What is wrong with my code?
:cry: :cry: :cry:
Re: How to open an existing powerpoint file?
please make the application visible before you open presentation in application object
means
ppApp.Visible = msoTrue
Set ppPresent = ppApp.Presentations.Open(CommonDialog2.FileName, msoCTrue, msoCTrue, msoCTrue)
try this