View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Jezebel Jezebel is offline
external usenet poster
 
Posts: 1,384
Default vba get table's object from bookmark

[range].Tables(1)

this returns a reference to the table that includes the range. The range can
be the selection, or the contents of a cell, or any range at all, eg

set pTable = activedocument.Bookmarks("mybm").Range.Tables(1)


Be aware that there are complications if you have nested tables.


"tack" wrote in message
...
using VBA;

I have serveral tables in a doc. One of the tables has a bookmark in one
of
its cells. How can I go from a bookmark to get the table reference the
bookmark is in? Better yet would be a cell reference that I could also use
to
get the table reference.

Using doc.Application.Selection.Information(W.WdInformat ion.wdWithInTable)
only tells me that the bookmark is in a table, not which table.

Thanks