PC Review


Reply
Thread Tools Rate Thread

Code from Powerpoint VBE not Working in Excel VBE?

 
 
Aaron
Guest
Posts: n/a
 
      20th Feb 2008
With a worksheet object selected in Powerpoint this code works perfectly from
PP VBE but from Excel VBE I get "Run-time error 429: ActiveX comonent can't
create object"

PowerPoint.Application.ActiveWindow.Selection.ShapeRange.Name = "testname"

Through tools references I have selected:
VBA
MS XL 11.0 obj lib
OLE auto
MS off 11.0 obj lib
MS PP 11.0 obj lib
and just for kicks I tried some MS ActiveX object libraies, but they did not
seem to help so I have deselected them now. Any ideas?



 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      20th Feb 2008
You need to declare a variable to represent the PowerPoint application:

Dim ppApp As PowerPoint.Application

Then you need to instantiate it in one of several ways. Assuming you have
Ppt running already:

Set ppApp = GetObject(, "PowerPoint.Application")

now adjust the line you posted:

ppApp.ActiveWindow.Selection.ShapeRange.Name = "testname"

Here's more on controlling one program from another:

http://peltiertech.com/Excel/XL_PPT.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Aaron" <(E-Mail Removed)> wrote in message
news:56CC44A7-EFF6-4408-9CF0-(E-Mail Removed)...
> With a worksheet object selected in Powerpoint this code works perfectly
> from
> PP VBE but from Excel VBE I get "Run-time error 429: ActiveX comonent
> can't
> create object"
>
> PowerPoint.Application.ActiveWindow.Selection.ShapeRange.Name = "testname"
>
> Through tools references I have selected:
> VBA
> MS XL 11.0 obj lib
> OLE auto
> MS off 11.0 obj lib
> MS PP 11.0 obj lib
> and just for kicks I tried some MS ActiveX object libraies, but they did
> not
> seem to help so I have deselected them now. Any ideas?
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code in Powerpoint 2007 stopped working with PowerPoint 2010 rbotelho Webmaster / Programming 0 27th Jul 2011 01:14 PM
Shared Addin not working in Excel and Word but working in Powerpoint Omer Microsoft VB .NET 0 2nd Dec 2007 08:06 PM
Working with Excel spreadsheets in powerpoint =?Utf-8?B?TWVnYW5F?= Microsoft Powerpoint 1 9th Feb 2006 10:04 PM
Working with Excel Pie Chart in PowerPoint =?Utf-8?B?RHVkbGV5?= Microsoft Powerpoint 7 27th Sep 2004 05:25 PM
Excel and Powerpoint. VB code Javier Microsoft Powerpoint 0 27th Jan 2004 05:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:18 AM.