Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Tables and stuff...
Message
De
29/04/2003 14:54:21
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Word Tables and stuff...
Divers
Thread ID:
00782867
Message ID:
00782867
Vues:
64
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform