Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding where a table starts in a Word doc

Status
Not open for further replies.

behbeh

Programmer
Mar 10, 2001
48
0
0
US
Hello!
Does anyone know if you can grab the Line Number on a page where a table starts in MS Word programatically?
 
I dont know of a way, but if this any help,

normally when i have to reference a table in word via VBA i use bookmarks, Ie insert a bookmark in the document and you can easily recall that in VBA


Filmmaker, gentlemen and proffesional drinker



 
Cool...I'll checkout Bookmarks (I haven't used those before). If I can scan the doc, insert bookmarks where all of the tables begin (if there are any in-between text paragraphs) and check for bookmarks as I go through the doc, that will probably work. Thanks...I'll give it a shot!
:)
 
Hi behbeh,

What do you actually want to do when you've identified where your tables are?

Enjoy,
Tony
 
Hi Tony,
Programatically, I need to open a document and extract information (in sentence order). I have to bust the free-form text into sentences and throw those into an array for text. I also have to grab the info in the table(s) and throw that info into an array for tables...don't ask why...it's just in the project plan I'm working on and it's complicated.
:(
Basically, I'll have an output something like cText(0), cText(1), cTable(0), cTable(1), cTable(2), cTable(3), cText(2), cText(3), etc...information in the order it is in the original document. I found that Word reads tables as sentences, and I haven't been able to check if the sentence is part of a table.
YUK!
:(

 
Hi behbeh,

Assuming you're doing something like ..

For Each Sent in Activedocument.range.sentences ...

You should be able to include in your loop ..

If Sent.tables.Count = 0 then
' Load Normal text array
Else
' Load TAbles text array
EndIf

Enjoy,
Tony
 
Hey thanks Tony! I didn't know about "Sent.Information(wdWithinTable)". I'll check it out.
Thanks for your help!
:)
BehBeh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top