How to access textrange members inside SmartArt

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.
 
C

Caio Milani

I'm not even trying to modify it. I just want to access and read the text.
But it is a collection.
 
C

Caio Milani

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
 
A

Arie Livshin

for (int i=1;i<=textRange.Count;i++)
{
TextRange ranger=textRange._item(1);
........
}

(or equivalent code in VB)


Arie
 

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