Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote this code to activate a powerpoint file (as a slideshow) and
quit powerpoint after the show is through and return to excel. The problem: Within secs of opening the file in powerpoint it quits (without running running the entire slideshow. Sub myShow() Dim zPPT As PowerPoint.Application Dim zPres As PowerPoint.Presentation Set zPPT = CreateObject("Powerpoint.Application") zPPT.Visible = msoTrue Set zPres = zPPT.Presentations.Open("prezex.ppt") zPres.SlideShowSettings.Run zPPT.Quit End Sub xxxxxxxxxxxxxxxxxxxx Could someone help? Thanks, Naveen |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try using module level variables. Put your Dims at the module top outside
of the subs. -- Jim Rech Excel MVP "Naveen Sukhramani" wrote in message om... |I wrote this code to activate a powerpoint file (as a slideshow) and | quit powerpoint after the show is through and return to excel. | | The problem: Within secs of opening the file in powerpoint it quits | (without running running the entire slideshow. | | | Sub myShow() | Dim zPPT As PowerPoint.Application | Dim zPres As PowerPoint.Presentation | | Set zPPT = CreateObject("Powerpoint.Application") | | zPPT.Visible = msoTrue | | Set zPres = zPPT.Presentations.Open("prezex.ppt") | zPres.SlideShowSettings.Run | | zPPT.Quit | | End Sub | | xxxxxxxxxxxxxxxxxxxx | | Could someone help? | | Thanks, | | Naveen |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Nope.... didn't quite work. If it helps, I'm using Excel 2000, OS = Win2000.
"Jim Rech" wrote in message ... Try using module level variables. Put your Dims at the module top outside of the subs. -- Jim Rech Excel MVP "Naveen Sukhramani" wrote in message om... |I wrote this code to activate a powerpoint file (as a slideshow) and | quit powerpoint after the show is through and return to excel. | | The problem: Within secs of opening the file in powerpoint it quits | (without running running the entire slideshow. | | | Sub myShow() | Dim zPPT As PowerPoint.Application | Dim zPres As PowerPoint.Presentation | | Set zPPT = CreateObject("Powerpoint.Application") | | zPPT.Visible = msoTrue | | Set zPres = zPPT.Presentations.Open("prezex.ppt") | zPres.SlideShowSettings.Run | | zPPT.Quit | | End Sub | | xxxxxxxxxxxxxxxxxxxx | | Could someone help? | | Thanks, | | Naveen |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Naveen -
I'm not sure the Excel macro waits for the entire slide show to run before executing the zPPT.Quit command. You could add a class module in your Excel project to capture the PowerPoint events. I used the following code, which fires the SlideShowEnd event procedure. Apparently you cannot quit the app from within the event procedure, so I use OnTime to run a separate procedure that quits PowerPoint, after the event procedure is finished. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Class module in Excel VBA, named CPptAppEvt '---------------- Option Explicit Public WithEvents pApp As PowerPoint.Application Private Sub pApp_SlideShowEnd(ByVal Pres As PowerPoint.Presentation) Application.OnTime Now + TimeValue("0:00:01"), "EndShow" End Sub '---------------- Regular module in Excel VBA '---------------- Option Explicit Dim zPPT As PowerPoint.Application Dim zApp As New CPptAppEvt Sub myShow() Dim zPres As PowerPoint.Presentation Set zPPT = CreateObject("Powerpoint.Application") Set zApp.pApp = zPPT zPPT.Visible = msoTrue Set zPres = zPPT.Presentations.Open _ ("C:\Documents and Settings\Jon Peltier\My Documents\prezex.ppt") zPres.SlideShowSettings.Run End Sub Sub EndShow() Dim preso As PowerPoint.Presentation For Each preso In zPPT.Presentations preso.Close 'False Next zPPT.Quit '' this line gives the error End Sub '---------------- Naveen Sukhramani wrote: Nope.... didn't quite work. If it helps, I'm using Excel 2000, OS = Win2000. "Jim Rech" wrote in message ... Try using module level variables. Put your Dims at the module top outside of the subs. -- Jim Rech Excel MVP "Naveen Sukhramani" wrote in message .com... |I wrote this code to activate a powerpoint file (as a slideshow) and | quit powerpoint after the show is through and return to excel. | | The problem: Within secs of opening the file in powerpoint it quits | (without running running the entire slideshow. | | | Sub myShow() | Dim zPPT As PowerPoint.Application | Dim zPres As PowerPoint.Presentation | | Set zPPT = CreateObject("Powerpoint.Application") | | zPPT.Visible = msoTrue | | Set zPres = zPPT.Presentations.Open("prezex.ppt") | zPres.SlideShowSettings.Run | | zPPT.Quit | | End Sub | | xxxxxxxxxxxxxxxxxxxx | | Could someone help? | | Thanks, | | Naveen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel-Powerpoint | Charts and Charting in Excel | |||
EXCEL AND POWERPOINT | New Users to Excel | |||
excel, powerpoint | Excel Discussion (Misc queries) | |||
Excel and Powerpoint | Excel Discussion (Misc queries) | |||
Excel to powerpoint | Excel Programming |