A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Determine Table Index Number in a Table Collection



 
 
Thread Tools Display Modes
  #1  
Old May 14th, 2004, 10:21 PM
Andrew
external usenet poster
 
Posts: n/a
Default Determine Table Index Number in a Table Collection

Simple problem I would think. In a document with multiple tables, how do I determine the index number of the table in which the cursor is located. I want to write this code

ActiveDocument.Tables(???)

How do I know if my current location is Tables(1), Tables(2) or Tables(3)

Thank you!
Andrew
  #2  
Old May 15th, 2004, 02:43 AM
Jay Freedman
external usenet poster
 
Posts: n/a
Default Determine Table Index Number in a Table Collection

Hi Andrew

See http://word.mvps.org/FAQs/MacrosVBA/...exNoOfPara.htm.

Pay special attention to the first part, which explains that you
usually don't need to know the absolute index of anything within the
document.

Something it doesn't say is that if you frequently refer to objects by
their absolute index, your macro is likely to run extremely slowly in
large documents. The reason is that every time you say something like
ActiveDocument.Tables(n), VBA starts with .Tables(1) and counts tables
up to n. If n is 100 or so, you'll bring the machine to its figurative
knees -- and it's totally unnecessary!

Andrew wrote:

Simple problem I would think. In a document with multiple tables, how do I determine the index number of the table in which the cursor is located. I want to write this code

ActiveDocument.Tables(???)

How do I know if my current location is Tables(1), Tables(2) or Tables(3)

Thank you!
Andrew



--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word
  #3  
Old May 15th, 2004, 03:36 AM
Andrew
external usenet poster
 
Posts: n/a
Default Determine Table Index Number in a Table Collection

Thanks!!!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.