Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-11-2012, 10:34 AM
CatMan CatMan is offline Excel VBA to automate PowerPoint Windows 7 32bit Excel VBA to automate PowerPoint Office 2010 32bit
Intermediate
Excel VBA to automate PowerPoint
 
Join Date: Apr 2012
Posts: 39
CatMan is on a distinguished road
Default Excel VBA to automate PowerPoint

Hello Forum, thank you for taking the time to look at this.



In an Excel module (Excel is host) I am opening an existing PPT like this:

Code:
Dim ppte As Object
Dim oPAe As PowerPoint.Application
Dim oPPe As PowerPoint.Presentation
Dim oPSe As PowerPoint.Slide
Dim oShapee As PowerPoint.Shape
Dim oPicturee As PowerPoint.Shape
 
With ppt  <--this is a typo, should be 'with ppte' as explained 2 threads down)
    .Visible = True
    .Presentations.Open ("C:\Users\User\Documents\MyPPT.ppt")
End With
Next I want to activate a user defined slide, the following code works ok as a PowerPoint macro:

Code:
ActiveWindow.View.GotoSlide 3 'works inside ppt
but not inside the Excel module:

Code:
With ppte
       .View.GotoSlide 11
End With
I get a run-time error (429). I notice I am not referencing the slide object (oPSe) but all my attempts to work this have failed.

Last edited by CatMan; 04-11-2012 at 04:59 PM.
Reply With Quote
  #2  
Old 04-11-2012, 10:51 AM
Cosmo Cosmo is offline Excel VBA to automate PowerPoint Windows Vista Excel VBA to automate PowerPoint Office 2007
Competent Performer
 
Join Date: Mar 2012
Posts: 240
Cosmo is on a distinguished road
Default

ppte is defined as 'Object', but you dont show any lines setting it to anything - What is it supposed to be?

'with ppt' ... ppt is not defined as a variable in your posted code, what type is it and where does it get set?

If this works
Quote:
With ppt
.Visible = True
.Presentations.Open ("C:\Users\User\Documents\MyPPT.ppt")
End With
then you should be able to change it to
Quote:
With ppt
.Visible = True
.Presentations.Open ("C:\Users\User\Documents\MyPPT.ppt")
.ActiveWindow.View.GotoSlide 3
End With
Reply With Quote
  #3  
Old 04-11-2012, 04:50 PM
CatMan CatMan is offline Excel VBA to automate PowerPoint Windows 7 32bit Excel VBA to automate PowerPoint Office 2010 32bit
Intermediate
Excel VBA to automate PowerPoint
 
Join Date: Apr 2012
Posts: 39
CatMan is on a distinguished road
Default

I am affaid I made a typo in my opening thread I typed
Code:
with ppt
instead of
Code:
with ppte
, I am sorry for the confusion that made. But you really helped me with the line
Code:
.ActiveWindow.View.GotoSlide 3
I was trying all kinds of variations on this, here are a few (bad) examples I used:

Code:
.ActivePresentation.SlideShowWindow.View.GotoSlide 3
.ActivePresentation.Slides.Range 3
.View.Slide.SlideIndex 3
And the kicker is I tried the code you offered
Code:
ActiveWindows.View.GotoSlide 3
but forgot to include the point at the start of the line!

I was really stuck on this one so I can't thank you enough for the help, this forum is a great help. Many thank to you Cosmo and all who dropped by.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate Office Attendance kgwack Outlook 0 02-14-2012 09:39 AM
Powerpoint/Excel richiejjj PowerPoint 0 02-09-2012 07:20 AM
How to automate all slides Pemberton PowerPoint 1 11-09-2011 04:39 PM
Automate Data from Excel into Word DropDown...? sigraves Word VBA 0 08-03-2009 06:54 AM
Automate Excel tabname deegz Excel 2 12-08-2008 02:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft