OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy |
Start a slide show and monitor it from an external application |
|
The example makes use of late binding. ' -------------------------------------------------------------------------------- Option Explicit Sub AutomatePoint() Dim oPPTApp As Object Dim oPPTPres As Object Dim PresPath As String On Error Resume Next PresPath = "D:\Presentation\Demo.ppt" Set oPPTApp = CreateObject("PowerPoint.Application") If Not oPPTApp Is Nothing Then With oPPTApp Set oPPTPres = .Presentations.Open(PresPath, , , False) If Not oPPTPres Is Nothing Then oPPTPres.SlideShowSettings.Run Do While .SlideShowWindows.Count > 0 DoEvents Loop Else MsgBox "The code could not open the specified file." & _ "Check if the file is present at the location.", _ vbCritical + vbOKOnly, "PowerPoint Automation Example" End If End With Else MsgBox "The code failed to instantiate PowerPoint session.", _ vbCritical + vbOKOnly, "PowerPoint Automation Example" End If Set oPPTPres = Nothing DoEvents oPPTApp.Quit DoEvents Set oPPTApp = Nothing MsgBox "The PowerPoint session was terminated.", _ vbInformation + vbOKOnly, "PowerPoint Automation Example" End Sub
|
|
Copyright 1999-2014 (c) Shyam Pillai. All rights reserved.