Macro to advance PPT slide
I had a similar type deal with regards to running an MS program from within
Excel Program. The first thing you will need to do is to go into
Tools>Reference, and checkmark "Microsoft Powerpoint" within the list of
References in the VBE. Once you have done that, you will then want a code
at the top of the module from which you plan on controlling the slides in
PPT.
Dim MSPPT as PowerPoint.Application
Now after doing these 2 things, you can then using the following macro to
get a reference to PowerPoint depend on if it's already open or not.
Function StartPPT() As Boolean
On Error Resume Next
If MSPPT is Nothing Then
Set MSPPT = GetObject(, "PowerPoint.Application")
If Err.Number <> 0 Then
'Since PowerPoint was not open, it will be opened by the
following command.
Set MSPPT = New PowerPoint.Application
End If
End If
StartPPT = Not (MSPPT Is Nothing)
End Function
The below code makes use of the above code.
Function OpenPPTFile(PPT_File as String)
StartPPT
OnError Goto ErrHandle
'This is the location for the Open code and may also want to put in a
check to be sure that the file isn't already open before trying to open the
file.
OpenPPTFile = True
Exit Function
ErrHandle:
OpenPPTFile = False
End Function
Note: You will use the MSPPT object variable to refer to the PowerPoint
Application Object such as "MSPPT.Presentations.Open"
For additional info of knowing how to control PowerPoint objects, you will
want to turn to the Power Point help files, MSDN Library, and/or Power Point
newsgroup. This should get you started with controlling Powerpoint from
within Excel's VBA or any of the MS programs within it's VBA.
--
Ronald R Dodge, Jr
Production Statistician
Master MOUS 2000
Quote:
> I'm running Office 2K/Win2K on a computer with three installed video
> cards/monitors. Excel is on monitor 2 and Powerpoint is on monitor 3
> (plasma display for customers to read). I'd like to add a CommandButton
> (VBA code) on my Excel spreadsheet that advances the slide in Powerpoint
> running in the full screen mode. Appreciate any assistance.