Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

How to access textrange members inside SmartArt

閲覧: 134 回
最初の未読メッセージにスキップ

Caio Milani

未読、
2009/09/04 15:12:012009/09/04
To:
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.

John Wilson

未読、
2009/09/05 2:08:012009/09/05
To:
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

Steve Rindsberg

未読、
2009/09/05 13:17:112009/09/05
To:
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...@microsoft.com>, Caio Milani
wrote:

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

Caio Milani

未読、
2009/09/15 18:36:102009/09/15
To:
I'm not even trying to modify it. I just want to access and read the text.
But it is a collection.

Caio Milani

未読、
2009/09/15 18:43:032009/09/15
To:
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

未読、
2009/09/16 13:35:252009/09/16
To:
I see. So let us know the steps to create one of the problem smart art types so we
can try it here.

In article <AE337FAA-B39A-4D76...@microsoft.com>, Caio Milani wrote:
> 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

Arie Livshin

未読、
2010/09/16 6:07:392010/09/16
To:
for (int i=1;i<=textRange.Count;i++)
{
TextRange ranger=textRange._item(1);
.......
}

(or equivalent code in VB)


Arie


>> On Saturday, September 05, 2009 2:08 AM John Wilson wrote:

>> The groupitems are read only. Don't ask me why , I do not 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:


>>> On Saturday, September 05, 2009 1:17 PM Steve Rindsberg wrote:

>>> This slightly modified version works here. All I have 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
>>>
>>> wrote:
>>>
>>>
>>> ==============================
>>> 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


>>>> On Tuesday, September 15, 2009 6:36 PM Caio Milani wrote:

>>>> I am not even trying to modify it. I just want to access and read the text.


>>>> But it is a collection.
>>>>
>>>> "John Wilson" wrote:


>>>>> On Tuesday, September 15, 2009 6:43 PM Caio Milani wrote:

>>>>> 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 is not possible to
>>>>> access the .TextFrame.TextRange.text property. Error "member can only be


>>>>> accessed for a single shape"
>>>>>

>>>>> Therefore I am trying to find a way to access each member of the


>>>>> .TextFrame.TextRange collection and then the text property
>>>>>
>>>>> "Steve Rindsberg" wrote:


>>>>>> On Wednesday, September 16, 2009 1:35 PM Steve Rindsberg wrote:

>>>>>> I see. So let us know the steps to create one of the problem smart art types so we
>>>>>> can try it here.
>>>>>>
>>>>>>
>>>>>>

>>>>>> ==============================
>>>>>> 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


>>>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>>>> ComponentOne Studio for ASP.NET AJAX - Free License Giveaway
>>>>>> http://www.eggheadcafe.com/tutorials/aspnet/ce98ce1f-2b5d-4ec8-b6d5-a1049651514e/componentone-studio-for-aspnet-ajax--free-license-giveaway.aspx

新着メール 0 件