How to manipulate chart objects in PPT2007-SP2

J

John Svendsen

Hi All:

I need to find&replace text in charts in PPT2007-SP2 (I used to do this in
PPT2003 using the code below).
I understand that wasn't possible in PPT2007 until SP2 came along, but I'm
not able to understand PPT2007's help fiiles and searches in the Internet
haven't come up with anything workable.

Can someone please point me towards the right direction?
Thanks for you kind attention and help.
TIA, JS

==================================
SubGraph_ReplaceHeadings()
SldNum = 0
For Each Sld In Application.ActivePresentation.Slides
SldNum = SldNum + 1
For Each Shp In Sld.Shapes
If Shp.Type = msoEmbeddedOLEObject Then
If Shp.OLEFormat.ProgID = "MSGraph.Chart.8" Then
Set objMSGraph = Shp.OLEFormat.Object.Application
MaxRows = 100: MaxColumns = 100 'The higher the #S, the slower this
gets; so set it as low as practical
With objMSGraph.DataSheet
For X = 1 To MaxRows ' Find LastRow
If .Rows(X).Include Then LastRow = X
Next X
For X = 1 To MaxColumns ' Find LastCol
If .Columns(X).Include Then LastCol = X
Next X
For lRow = 1 To LastRow ' Row headings
If .Rows(lRow).Include Then
If InStr(.Cells(lRow, 1), "hi") > 0 Then
.Cells(lRow, 1) = Replace(.Cells(lRow, 1), "hi","hello")
End If
End If
Next lRow
For lCol = 1 To LastCol ' Column headings
If .Columns(lCol).Include Then
If InStr(.Cells(1, lCol), "hi") > 0 Then
.Cells(1, lCol) = Replace(.Cells(1, lCol), "hi","hello")
End If
End If
Next lCol
Loop
Close #1
End With ' objmsgraph
objMSGraph.Update
objMSGraph.Quit
Set objMSGraph = Nothing
End If
End If
Next Shp
Next Sld
End Sub

==================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top