Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2007

Tip: Looking for answers? Try searching our database.

Find a Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim - 04 Jun 2007 20:18 GMT
Tables are accessed by an integer index.  Suppose I have a document with
tables that I need to update programmatically.  Also, the end user is
allowed to edit the document, potentially changing the table index.  Is
there any technique for locating a particular table other than by index?
(It would be pretty helpful if you could give a Table a Name or Tag value!)

TIA,
Jim
alborg - 05 Jun 2007 06:19 GMT
Hi Jim:

Actually, it looks like a pretty easy thing to do:

1) Place a bookmark in the table you wish to select
2) Use a statement to go to said bookmark like-

Selection.GoTo What:=wdGoToBookmark , Which:=wdGoToFirst, Count:=1,
Name:="MyBookmarkTest"

3) Now use a statement like-

If Selection.Information(wdWithInTable) Then Selection.Tables(1).Select

Bingo- not only is table located, but it is now selected and ready to be
abused...
I tried it out and the table ends up selected (i.e. blacked out).

Cheers,
Al

> Tables are accessed by an integer index.  Suppose I have a document with
> tables that I need to update programmatically.  Also, the end user is
[quoted text clipped - 4 lines]
> TIA,
> Jim
Jim - 05 Jun 2007 14:30 GMT
Excellent!  Works perfectly.

> Bingo- not only is table located, but it is now selected and ready to be
> abused...

My plan exactly.

Thanks,
Jim

> Hi Jim:
>
[quoted text clipped - 26 lines]
>> TIA,
>> Jim
Ed - 05 Jun 2007 17:00 GMT
Bookmarks are easily destroyed by overwriting.  If you are concerned
the user might edit over your bookmark, you might try adding an extra
row and put your bookmark there, then set that row height to something
like 0.01.

Ed

> Excellent!  Works perfectly.
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -
muyBN - 05 Jun 2007 19:49 GMT
Good safeguard idea from Ed. You could either do this with the extra row or
select the whole table and maybe also a paragraph mark after it then insert
the bookmark. That way the bookmark will stick around as long as the whole
table isn't deleted.

Signature

Bryan

> Bookmarks are easily destroyed by overwriting.  If you are concerned
> the user might edit over your bookmark, you might try adding an extra
[quoted text clipped - 45 lines]
> >
> > - Show quoted text -
Jim - 05 Jun 2007 20:35 GMT
I placed a BM in Cell(1,1) and I can't delete it when working with the
table.  I have to go to Insert | Bookmark and Delete there.  So I'm not too
worried about accidental deletions.  My users know that they edit at their
own risk.

BTW, when I select the table AND the following paragraph mark, the BM is no
longer reported as being in a table.  Selecting just the table is OK.

Thanks for the tips, all.

> Good safeguard idea from Ed. You could either do this with the extra row
> or
[quoted text clipped - 59 lines]
>> >
>> > - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.