View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Run PPT code from excel

I am trying to run the following code but get this error message:
Run-Time error '429': ActiveX component can't create object
I have referenced the Microsoft PowerPoint 11.0 Object Library

Sub ChangeUpdateMode()
Dim objPPT As Object

Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
objPPT.Presentations.Open ThisWorkbook.Path & "\Template.ppt"

Dim sld As Slide
Dim sh As Shape
For Each sld In ActivePresentation.Slides 'THIS LINE CAUSES ERROR
For Each sh In sld.Shapes
If sh.Type = msoLinkedOLEObject Then
' Set the link to manual update mode
sh.LinkFormat.AutoUpdate = ppUpdateOptionManual
End If
Next sh
Next sld

Set objPPT = Nothing

End Sub


I also get the same error if I try to open PPT using this line of code from
Excel VBA:
PowerPoint.Application.Presentations.Open strOpenPath

Does anyone have any suggestions on how I can avoid this?

Thanks!
Dan