Determine the index number of the current shape 
Author Message
 Determine the index number of the current shape

Hi,
    Could someone tell me how to determine the index number or the name of
the current shape (Text Frame)?

Thanks.
Wu Hailong



Sat, 08 Nov 2003 11:10:47 GMT  
 Determine the index number of the current shape

To get the shape's name:  MsgBox Selection.ShapeRange(1).Name

To get its index number:  Weeeeell, first you probably should read
http://www.mvps.org/word/FAQs/MacrosVBA/GetIndexNoOfPara.htm to get
the full pep talk on why you probably *don't* really need the index
number.  Then if you still think you do:

Dim sh As Shape, i As Integer
For Each sh In ActiveDocument.Shapes
   i = i + 1
   If Selection.InRange(sh.TextFrame.TextRange) Then
      MsgBox "This is shape number " & i
      Exit For
   End If
Next sh


------ WWW: http://www.speakeasy.org/~mtangard ----------------------
------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------

Quote:

> Hi,
>     Could someone tell me how to determine the index number or the name of
> the current shape (Text Frame)?

> Thanks.
> Wu Hailong



Mon, 10 Nov 2003 18:47:59 GMT  
 Determine the index number of the current shape

To get the shape's name:  MsgBox Selection.ShapeRange(1).Name

To get its index number:  Weeeeell, first you probably should read
http://www.mvps.org/word/FAQs/MacrosVBA/GetIndexNoOfPara.htm to get
the full pep talk on why you probably *don't* really need the index
number.  Then if you still think you do:

Dim sh As Shape, i As Integer
For Each sh In ActiveDocument.Shapes
   i = i + 1
   If Selection.InRange(sh.TextFrame.TextRange) Then
      MsgBox "This is shape number " & i
      Exit For
   End If
Next sh


------ WWW: http://www.speakeasy.org/~mtangard ----------------------
------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------

Quote:

> Hi,
>     Could someone tell me how to determine the index number or the name of
> the current shape (Text Frame)?

> Thanks.
> Wu Hailong



Mon, 10 Nov 2003 18:47:59 GMT  
 Determine the index number of the current shape
I agree about the index numbers. But the StoryRanges question gets pretty
complicated, actually, due to some limitations with the StoryRanges object--it
doesn't come close to iterating every StoryRange in a document. Have a look at
the "StoryRange" thread beginning on May 23.
Quote:
-----Original Message-----

To get the shape's name:  MsgBox Selection.ShapeRange(1).Name

To get its index number:  Weeeeell, first you probably should read
http://www.mvps.org/word/FAQs/MacrosVBA/GetIndexNoOfPara.htm to get
the full pep talk on why you probably *don't* really need the index
number.  Then if you still think you do:

Dim sh As Shape, i As Integer
For Each sh In ActiveDocument.Shapes
   i = i + 1
   If Selection.InRange(sh.TextFrame.TextRange) Then
      MsgBox "This is shape number " & i
      Exit For
   End If
Next sh


------ WWW: http://www.speakeasy.org/~mtangard ----------------------
------------- "Life is nothing if you aren't obsessed." --John Waters
---------------------------------------------------------------------


> Hi,
>     Could someone tell me how to determine the index number or the name of
> the current shape (Text Frame)?

> Thanks.
> Wu Hailong
.



Mon, 10 Nov 2003 23:35:03 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. determining current Items index from MailItem

2. Finding index or shape number

3. How do I retreive the current paragraph index number

4. Return sentence index number from current cursor position

5. Current Row Number / Index ?

6. determining the index number of a table

7. Current control number - how to determine

8. Determine current line number in textarea

9. How to determine current DNS server IP number?

10. How to determine current DNS server IP number?

11. DATES ISSUE: Number of the current Week of the current Month

12. Finding out what a shape index is?

 

 
Powered by phpBB® Forum Software