From: Caio Milani on
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.



From: John Wilson john AT technologytrish.co DOT on
The groupitems are read only. Don't ask me why , I don't know.
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
PPTLive Atlanta Oct 11-14 2009




"Caio Milani" wrote:

> 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.
>
>
>
From: Steve Rindsberg on
This slightly modified version works here. All I've really done is change the
variable names and added the missing End With, etc.

It may have to do with the type of smartart, but also, have you applied any
Service Packs? As it happens, I did this in a computer with SP1 installed.

Dim oSh As Shape
Dim oSl As Slide
Dim x As Long

Set oSl = ActivePresentation.Slides(1)

For Each oSh In oSl.Shapes
With oSh
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
End With
Next

End Sub

In article <04CE56A9-4AAA-4CB2-B5A0-C09BA8A7DFD5(a)microsoft.com>, Caio Milani
wrote:
> 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.


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/

Don't Miss the PPTLive User Conference! Atlanta | Oct 11-14

From: Caio Milani on
I'm not even trying to modify it. I just want to access and read the text.
But it is a collection.

"John Wilson" wrote:

> The groupitems are read only. Don't ask me why , I don't know.
> --
> john ATSIGN PPTAlchemy.co.uk
>
> Free PPT Hints, Tips and Tutorials
> http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
> PPTLive Atlanta Oct 11-14 2009
>
>
>
>
> "Caio Milani" wrote:
>
> > 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.
> >
> >
> >
From: Caio Milani on
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

"Steve Rindsberg" wrote:

> This slightly modified version works here. All I've really done is change the
> variable names and added the missing End With, etc.
>
> It may have to do with the type of smartart, but also, have you applied any
> Service Packs? As it happens, I did this in a computer with SP1 installed.
>
> Dim oSh As Shape
> Dim oSl As Slide
> Dim x As Long
>
> Set oSl = ActivePresentation.Slides(1)
>
> For Each oSh In oSl.Shapes
> With oSh
> 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
> End With
> Next
>
> End Sub
>
> In article <04CE56A9-4AAA-4CB2-B5A0-C09BA8A7DFD5(a)microsoft.com>, Caio Milani
> wrote:
> > 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.
>
>
> ==============================
> PPT Frequently Asked Questions
> http://www.pptfaq.com/
>
> PPTools add-ins for PowerPoint
> http://www.pptools.com/
>
> Don't Miss the PPTLive User Conference! Atlanta | Oct 11-14
>
>