Re: Problems in reading sentences from the document that has tables



Hi,

Thanks very much for your reply, but I did try this and like Mr.Helmut has
stated in his reply, this does not seem to work with tables that has a empty
first cell. What could be the reason for this problem?

Thanks again.

Regards,
Laks


"Jonathan West" <jwest@xxxxxxxx> wrote in message
news:uEDU4dQbFHA.612@xxxxxxxxxxxxxxxxxxxxxxx
> Change your code so that you don't include the closing paragraph mark of
> each paragraph when you are going through the sentances. This should do
the
> trick
>
> Dim myRange as Range
> For Each para in ThisDocument.Paragraphs
> Set MyRange = para.Range
> MyRange.MoveEnd Unit:=wdCharacter, Count:=-1
> For Each paraRange in MyRange.Sentences
> If (paraRange.Tables.Count == 0) Then
> Debug.Print paraRange.Text
> End If
> Next
> Next
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
> Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
>
> <cameo007_2k@xxxxxxxxxxx> wrote in message
> news:e9Oa6CPbFHA.1360@xxxxxxxxxxxxxxxxxxxxxxx
> > 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

  • Re: Dont want updated fields to be printed
    ... Or am I misunderstanding the purpose of that option? ... >letter and use the CREATEDATE field in that template. ... >Doug Robbins - Word MVP ... >> Regards, ...
    (microsoft.public.word.printingfonts)
  • Re: Display problems
    ... Which graphic driver do you have?Update the driver from the manufacturer's website. ... www.decizium.com/screen2.jpg (Word document). ... I just bought a new laptop with Windows XP Family Edition and I installed ...
    (microsoft.public.windowsxp.general)
  • Re: Thoughts - Saving Word documents in SQL Server?
    ... Did you open the word document in ... > document into sql server, instead, we saved the file to a file storage area, ... > in the database, upon retrieval of a file we simply renamed it on the fly. ... > I can't offer much help with regards to saving a file into SQL alas, ...
    (microsoft.public.sqlserver.programming)
  • Re: Next Record if ...
    ... Doug Robbins - Word MVP wrote: ... I am trying to set up a mailmerge ... >> Regards, ...
    (microsoft.public.word.mailmerge.fields)
  • Re: do variables preserve their value after documents are saved?
    ... Regards, ... Microsoft Word MVP FAQ: http://word.mvps.org ... >> Private Sub Document_New ... >> Private Sub CommandButton1_Click ...
    (microsoft.public.word.vba.beginners)