Automating macros
Although you can perform pretty much any Word action through Automation, if you already have a Word macro to do a particular thing, it might make more sense to use the existing macro than to rewrite it in VFP. This is especially true if the macro doesn t involve transferring information between the two applications, or if it s part of a pre-packaged set of macros.
The Application object s Run method allows you to execute Word macros. You pass the name of the macro and up to 30 parameters. For example, AcceptAllRevisions is a custom macro that accepts all revisions and turns off revision tracking. This line executes it:
oWord.Run("AcceptAllRevisions")
In this case, it wouldn t be hard to create the same functionality through Automation since the macro has just two lines, but there are situations where rewriting an existing macro as Automation code would present a problem. In those cases, Run provides an easy solution.
Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved