Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How would you run the slide show through just the click event procedur

Status
Not open for further replies.

samuelsisgay

Programmer
Apr 17, 2002
4
0
0
AU
How would you load and run a powerpoint slide show through a single click event procedure?
I tryed by declaring the variable but didnt get it.
Ie.
Dim ppApp As PowerPoint.Application
Set ppApp = CreateObject("Powerpoint.Application")

' Make it visible.
ppApp.Visible = True
ppApp.Open ("C:\WINDOWS\Desktop\sanju\VB Major Project YR12\MajorProject.Empathy.ppt")
' Prepare and run the slide show.
With ppPres.SlideShowSettings
.ShowType = ppShowTypeKiosk
.LoopUntilStopped = msoTrue
.RangeType = ppShowAll
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
End With

' Sleep so user can watch the show.
Sleep (15000)

' Clean up.
ppApp.Quit
 
tried this on my PC

Code:
Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Private Sub Command1_Click()
  Dim oApp As PowerPoint.Application
  Dim oDoc As PowerPoint.Presentation
  Dim sFile As String
  
  sFile = "C:\WINDOWS\Desktop\sanju\VB Major Project YR12\MajorProject.Empathy.ppt"
  Set oApp = CreateObject("PowerPoint.Application")
  oApp.Activate
  Set oDoc = oApp.Presentations.Open(sFile, msoTrue, msoFalse)
  
  With oDoc.SlideShowSettings
    .ShowType = ppShowTypeKiosk
    .LoopUntilStopped = msoTrue
    .RangeType = ppShowAll
    .AdvanceMode = ppSlideShowUseSlideTimings
    .Run
  End With
  
  Sleep 15000
  
  oDoc.Saved = msoTrue
  oDoc.Close
  Set oDoc = Nothing
  
  oApp.Quit
  Set oApp = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top