by Chris Cabayao (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 13th April 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Open/View/Close a Powerpoint Presentation File
API Declarations
*'Add Microsoft Powerpoint 8.0Oject Library Office '97 in References
*'This code snipplet come from Microsoft Office Development site
Add commandbuuton in the from and name it cmdOpenPPT
In cmdOpenPPT_Click add the code below:
OpenPresentation(strFilename)
'* strFilename = Powerpoint Presentation File
Sub OpenPresentation(strFilename As String)
Dim oPPT As PowerPoint.Application
Set oPPT = New PowerPoint.Application
'open a powerpoint file
With oPPT
.Visible = True
.Presentations.Open (strFilename)
.Presentations(strFilename).Close
End With
'View the slide show
'Sleep 500
With oPPT.ActivePresentation.SlideShowSettings
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
End With
'Wait until there are no more slide show windows and then quit
'Powerpoint
Do
' Sleep 1000
Loop While oPPT.SlideShowWindows.Count > 0
oPPT.Quit
Set oPPT = Nothing
End Sub
Private Sub cmdOpenPPT_Click()
OpenPresentation "c:\files\takefive.pps"
End Sub