Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word question
Message
De
10/04/2001 13:01:27
 
 
À
04/04/2001 14:13:07
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00492015
Message ID:
00494073
Vues:
19
>What is the best way to get the current page and current column that the cursor is in when automating Word? I need to be able to output some text - collapse my range to the end of what I just output - and the ndetermine what page and column I am in.


I would never claim that this is the 'best' way. But, I just looked in the Visual Basic Help for Word and found the following:

Use the information property of a range or selection expression. eg.,

Assumption: myrange is collapsed in a table cell
myrange.information(wdActiveEndPageNumber) 
myrange.information(wdEndOfRangeColumnNumber)
If you are not yet aware of the VB Editor in Word, you need to avail yourself of it, pronto!. It is probably already available on the Tools/Macro menu, but if not, you can load it from your Windows sources CD. When you get into the VB editor, open up the Object Browser and search for 'information'. In the search results, select the Libarary=Word,Class=Range,Member=Information line and then right click on it. Then select help....That's what I did to find the above information for you.

I won't promise that this gives you exactly what you want, but a few experiments should tell you.

By the way, VFP does not know about the word constants (the values whose names start with 'wd'). There are ways to import these from dynamic libraries or you can just #DEFINE the few that you need - I prefer the latter approach and hope and pray that Microsoft never changes things. You can easily determine the value of one of these 'wd' constants by searching for it, then selecting it from the search results list. This will cause it's value to be given at the bottom of the Class Browser frame.

If you are new to the VB Editor, try searching on Application and then invoke the Help on the Application Object as you did above for the Information Property. This should reveal a help dialog with a hierarchical graphic in the upper left hand corner...click on the blue 'Application' rectangle...Voila!

..A whole new world will be opened to you....and then you, like me, can be as Mickey in the Sourcerer's Apprentice (from Fantasia)...

Happy conjuring....!

PS. I also highly recommend 'Microsoft Office Automation with Visual Foxpro' by Granor and Martin from Hentzenwerke (sometimes referred to as 'AutoFox')
"The Iron Fish: The water is cold...but the fish don't mind"
...Jay Jenks, boyhood chum
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform