Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Run PPT code from excel

Dan,

I would try always fully qualifying the objects:

For Each sld In ActivePresentation.Slides

should be:

For Each sld In objPPT.ActivePresentation.Slides

HTH,
Bernie
MS Excel MVP

"Dan" wrote in message
...
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



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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Word VBA Code to Excel Code Lee Excel Programming 1 September 24th 04 04:03 AM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM


All times are GMT +1. The time now is 06:21 AM.

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

About Us

"It's about Microsoft Excel"