Problems in reading sentences from the document that has tables

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

I am trying to read the sentences from a Word document, and skipping the
tables in the document, using the following code:

For Each para in ThisDocument.Paragraphs
For Each paraRange in para.Range.Sentences
If (paraRange.Tables.Count == 0) Then
Debug.Print paraRange.Text
End If
Next
Next

I find that for the sentences that are immediately above a table, like the
one below,

Rank Table:
------------------------------------------------------------
| 1 | Nadal
|
------------------------------------------------------------
| 2 | Puerta
|
------------------------------------------------------------

The para.Range.Text contains "Rank Table:\r", but when I try to read the
sentences from the para.Range.Sentence, object model is returning "\r\a",
which has a table count of 1. Thus, these types of sentences are being
ignored!! Have anyone else encountered a similar scenario? Any help is
appreciated.

Thanks in advance.

Regards,
Laks


.



Relevant Pages

  • Editing word doc?
    ... Can I edit a word document with tcl? ... para heading is modified to match the list element, ...
    (comp.lang.tcl)
  • Including para numbers in hyperlink
    ... I am creating hyperlinks in a Word document to link to other sections of the ... I have used automatic numbering and would like the para numbers to ... At the moment only the para name appears. ...
    (microsoft.public.word.docmanagement)