You may create a bookmark for "your" table. Then you do not need to search for text.
To close withouit saving:
.Quit(0)
>Hi all...
>
>First, I have purchased Tamar/Della's Microsoft Office Automation with Visual FoxPro. Brilliant. So much now on the subject - and I don't have to play with the obj models that much anymore... (enough free advertising).... :-)
>
>Here is my problem: I have word document with three tables on it. How to I 'immediately' address the second table. Normally, the answer is:
>
>
>*-- all the word prep stuff here. Assume all is okay.
>objwordapplication = CREATEOBJECT("Word.Application")
>objworddocument = objwordapplication.Documents.Open(myTableDocument)
>*-- If I know there are only three tables, then I can access my certain table properties by:
>objworddocument.Tables[2].tablepropertystuffhere
>
>
>But, what if the user has gone in and modified the document, and added another table? Now there is four, and I only want my specific one... so I will look for some text in my specific table (assume no user changes to that table):
>
>
>*-- all the word prep stuff here. Assume all is okay.
>objwordapplication = CREATEOBJECT("Word.Application")
>objworddocument = objwordapplication.Documents.Open(myTableDocument)
>oRange = objworddocument.Range(0, 0)
>WITH oRange.Find
> .Text = "zzzmytabletext"
> .MatchCase = .F.
> .Format = .F.
> .lFound = .Execute()
>ENDWITH
>*-- Assume .lFound is True
>*-- ??? Lost here. I know my text is there, but how do I know the table number?
>
>
>And my final question: How do I close an automated word document without saving my changes?
>
>
>TIA
>
>Ric