How to access textrange members inside SmartArt

  • Thread starter Thread starter Caio Milani
  • Start date Start date
C

Caio Milani

Hi,

I am trying to access textrange.text property inside a msoSmartArt

if I use the code below I get

"member can only be accessed for a single shape" at Debug.print line

For Each oShp In oSld.Shapes
With oShp
If .Type = msoSmartArt Then
For x = 1 To .GroupItems.Count
With .GroupItems(x)
If .HasTextFrame Then
If .TextFrame.HasText Then
Debug.Print .TextFrame.TextRange.text
End If
End If
End With
Next x
End If

The .GroupItems(x).TextFrame.TextRange.Count returns 3. At the locals window
a can see that each of these 3 object refers to each line of text inside the
shape.

How do I access the collection members?
I tried

..GroupItems(x).TextFrame.TextRange(1).TextRange.text and it fails.
 
I'm not even trying to modify it. I just want to access and read the text.
But it is a collection.
 
Yes, it has to do with the type of smart art. Some types of smart art have a
collection inside the .TextFrame.TextRange, hence it's not possible to
access the .TextFrame.TextRange.text property. Error "member can only be
accessed for a single shape"

Therefore I'm trying to find a way to access each member of the
..TextFrame.TextRange collection and then the text property
 
for (int i=1;i<=textRange.Count;i++)
{
TextRange ranger=textRange._item(1);
........
}

(or equivalent code in VB)


Arie
 
Back
Top