Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WORD MACROS Undocumented in VFP ?
Message
De
07/03/2001 14:31:55
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00481318
Message ID:
00482843
Vues:
9
>>I believe that since VFP is apparently attempting to provide us with a syntax (and it is a VFP syntax ... not WORD syntax) for 'talking' to the WORD object, it seems reasonable to expect them to document it. There must be complete documentation on this somewhere within the MICROSOFT operation. Give it to us ! Don't hide it.
>
>Actually, what we use when we automate the Word object is COM. Both VBA (the macro language) and VFP access the same properties and methods of the object, but VFP does it through the COM interface. There's some overhead involved with using COM, and some "features" of the COM implementation that can cause some grief from VFP because of VFP's implementation of COM (vs. the implementations in other languages, such as VB or VC.) Automating Word is almost the same as automating a third-party control that you drop on a form--you access the control's properties and methods (except you don't drop Word on a form <s>).
>
>Another difference is that the macro language in the Office suite is VBA -- that is, Visual Basic for Applications. It's VB--NOT VFP. All that's needed is a little patience and a lot of experimenting to get the syntax right. Most of the problems are putting in parentheses in method calls, removing the named parameters (size:=12), defining the constants (those long names that start with 'wd'), and ensure that you wrap the whole thing in a WITH oWord ...ENDWITH, and put dots in front of the object references.
>
>You asked Tamar how she learned all this, as the documentation appears to be non-existant. Well, I'll let Tamar speak for how she learned it, as she has a few different methods than I had. However, I spent a LOT of time in the Microsoft Knowledge Base, looking at more VB/VBA code than I care to imagine. Once you get the hang of it, it's second nature to translate it. I also used the Help files that come with Office...in Word, go down to one of the last entries in the Help file that talks about VB. This gets you the VB documentation for each of the properties and methods. This is also available on the MSDN on-line library as the Microsoft Office 2000 Language Reference, and has a volume specifically for Word.
>
>From there, it's a lot of trial and error. Automating Office servers is both the most FRUSTRATING thing I've ever done, because the most of the documentation isn't written for VFP. However, once the project's done and the client (or co-worker, or even myself) ooohs and aaaahs over it, I pretty much forget about the frustration (until I start implementing the next feature <g>). Our strategies for minimizing the frustration are covered in Chapter 3, in the Debugging section.
>
>If you're having a lot of trouble getting started, I might recommend skimming the first three chapters, then work along with the text in Chapter 4. Start at the beginning of Chapter 4, and type the example code into the Command Window (or download the .CHM and cut-and-paste), and see how it works. Sometimes the concepts build on each other, and diving into middle of the chapter can actually be counter-productive (and I'm the most guilty person for doing this!). Don't forget that at the end of each chapter is a "Putting it all together" sample program, which you can dissect. And when you get stuck, don't hesitate to post specific questions here.
>
>I hope this helps,
>
> - della


Della (and you too TAMAR), I am certainly appreciative of the time you have spent addressing this problem of mine. I was hoping for something a little more straight-forward like "Here is the VFP syntax for doing anything you would ever wish to do in WORD" but I guess the reality is ... It just doesn't exist. At least not in a nice neat little package. I don't work with WORD enough to justify a lengthy learning cycle so I look for a cookbook approach. I guess I will have to try to find some time and build a better base of knowledge from which to work. Thanks again for your help. Please consider writing a book which translates from WORD macros to VFP code .... I would be the first in line at the bookstore.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform