Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Running Powerpoint from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Running Powerpoint from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Running Powerpoint from Excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Running Powerpoint from Excel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel-Powerpoint Denver Charts and Charting in Excel 1 June 21st 09 10:57 AM
EXCEL AND POWERPOINT CANDELYN. CARPENTER New Users to Excel 2 May 12th 05 01:10 PM
excel, powerpoint srm Excel Discussion (Misc queries) 1 January 16th 05 03:40 AM
Excel and Powerpoint freekrill Excel Discussion (Misc queries) 0 November 26th 04 01:50 AM
Excel to powerpoint toddmbright Excel Programming 1 May 29th 04 03:03 AM


All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"