Microsoft Excel - No one has figured this out, I can't :(

Asked By Dan on 06-Dec-11 11:23 AM
I am trying to create a macro in Excel to open and select slide #2 and then the chart in apowerpoint file.  I have part of the code to open the powerpoint file, but can not figure out how to select slide #2 and the chart in slide #2 in the powerpoint file.  Any ideas?

Dan
Riley K replied to Dan on 06-Dec-11 08:24 PM


I have not tested this but try like this


Dim oPPTApp As PowerPoint.Application
Dim oPPTShape As PowerPoint.Shape
Dim oPPTFile As PowerPoint.Presentation
Dim SlideNum As Integer
Sub PPTableMacro()
  Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String
  strPresPath = "H:\PowerPoint\Presentation1.ppt"
  strNewPresPath = "H:\PowerPoint\new1.ppt"
   
  Set oPPTApp = CreateObject("PowerPoint.Application")
  oPPTApp.Visible = msoTrue
  Set oPPTFile = oPPTApp.Presentations.Open(strPresPath)
  SlideNum = 2
  oPPTFile.Slides(SlideNum).Select


Refer this link 

http://www.mahipalreddy.com/vba.htm


Regards
Dan replied to Riley K on 07-Dec-11 06:42 AM
Thank you. I have one last piece of this puzzle.  Having the macro select the chart on the slide and "Refresh Data" (I have to manually do this for all the slides that have charts :( ).  Powerpoint 2010 does not have the recorder anymore and I do not not how to make this happen.  Any help in finishing this would be greatly appreciated.

Dan