View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.powerpoint,microsoft.public.office.developer.vba
Tushar Mehta Tushar Mehta is offline
external usenet poster
 
Posts: 1,071
Default Excel to Powerpoint Slow Execution

I don't know what else is going on, but both your instantiation of the
PP application and your error handling are themselves error-prone.

First, you have two back-to-back CreateObject statements. Luckily for
you, PP is a single-instance app. If you used the same code with XL
you would have any number of instances of XL in memory with no way to
terminate them (except through CTRL-ALT-DEL).

Second, you execute a 'Resume Next' statement w/o the existence of an
error. That, in itself is an error! Create a watch expression for
err.number and err.description then step through the code and you will
see where the Resume Next line itself generates an error!

A much safer way to instantiate the PP application (or any other
similar app for that matter) would be:

Sub StartOtherApp()
Dim ppApp As PowerPoint.Application, IStartedPP As Boolean
On Error Resume Next
Set ppApp = GetObject(, "powerpoint.application")
On Error GoTo 0
If ppApp Is Nothing Then
IStartedPP = True
Set ppApp = CreateObject("powerpoint.application")
End If
'Do my stuff
If IStartedPP Then
ppApp.Quit
End If
Set ppApp = Nothing
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Dim oPPApp As PowerPoint.Application
Dim PPpres As PowerPoint.Presentation
Dim pSlide As PowerPoint.Slide
Dim sFileName As String
Dim iSlide As Integer ' Slide Index

AccessTime = Now()

On Error GoTo ErrCheck
Set oPPApp = CreateObject("Powerpoint.Application")

ErrCheck:
Set oPPApp = CreateObject("Powerpoint.Application")
Resume Next

MsgBox Format(Now() - AccessTime, "hh:mm:ss.s")

sFileName = (...Some File...)
oPPApp.Visible = msoCTrue
Set PPpres = oPPApp.Presentations.Open(sFileName)