PPT XP getting text from a textbox

  • Thread starter Thread starter Steven Knight
  • Start date Start date
S

Steven Knight

Hi,

Here is my question hopefully in a readable format!

I a using Office 2003 and I would to loop through all "shapes" in all
slides on a presentation and put the text into a variable for some
processing.

Here is the code I use for 2003:

For Each aslide In objPowerpoint.Presentations(1).Slides
For i = 1 To aslide.Shapes.Count
StrTxt = aslide.Shapes(i).TextFrame.TextRange.Text 'XP stops
here!
StrTxt = SomeFunction(Strtxt)
Next
Next

When I use this in XP it doesn't like it and gives an error.

Does anyone know why? Does anyone have XP compatible code that does
the same thing?

Thanks in anticipation.

Steven
 
Steven Knight said:
Hi,

Here is my question hopefully in a readable format!

I a using Office 2003 and I would to loop through all "shapes" in all
slides on a presentation and put the text into a variable for some
processing.

Here is the code I use for 2003:

For Each aslide In objPowerpoint.Presentations(1).Slides
For i = 1 To aslide.Shapes.Count
StrTxt = aslide.Shapes(i).TextFrame.TextRange.Text 'XP stops
here!
StrTxt = SomeFunction(Strtxt)
Next
Next

When I use this in XP it doesn't like it and gives an error.

Does anyone know why? Does anyone have XP compatible code that does
the same thing?


1) What's the error message?
2) Are you testing the same presentation in both XP and 2003? Does it bark at
the same shape in both?

In any case, if you're checking all the shapes on a slide you really should do:

With aslide.Shapes(i)
If .HasTextFrame Then
If .TextFrame.HasText Then
' Do your stuff
End If
End if
End With


--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================
 
Back
Top