View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.powerpoint,microsoft.public.office.developer.vba
Howard Kaikow Howard Kaikow is offline
external usenet poster
 
Posts: 269
Default Excel to Powerpoint Slow Execution

1. You are creating the Powerpoint object twice.
2. Create the object outside of the loop.
3. If you are running NAV, disable the NAV Office plug-in, but do NOT
disable NAV's AutoProtect.
4. Use With and End With to remove unnecessary references to objects, e.g.:

With oPPApp
.visible = msoCTrue
Set PPpres = .Presentation.Open(sFileName)
End With
5. Likely, there are other code improvements possible in the full code.
--
http://www.standards.com/; See Howard Kaikow's web site.

"Francis de Brienne" wrote in message
om...
Hello to all,

My problem is this, I am creating Charts on the fly, sending them to
Powerpoint and doing some little formating and then closing and saving
powerpoint. I loop through this for 60 graphs.

The problem is not that the code is not working but that Excel as
problems creating the Powerpoint.application object. It can take up to
30 sec for excel to create the activex component.

Here is the code :

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)

I am looking for a way to make the object creation faster. If anybody
can help me, this would be greatly appreciated.

Thanks Francis