Kbase P4698: Tips for using Excel and Word via ActiveX Automation
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  03/03/2009 |
|
Status: Verified
GOAL:
Tips for using Excel and Word via ActiveX Automation
GOAL:
How to learn what methods and properties are available for an ActiveX object
GOAL:
How to use the Progress COM Object Viewer
FACT(s) (Environment):
Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x
FIX:
Progress Protools (Pro*tools) has a useful tool called COM Object Viewer. With this tool it is possible to see all the methods, attributes, etc that can be used with OCX controls like Word/Excel (ActiveX Automation Servers) and some dll's.
To see all the methods of MS Word within the COM Object Viewer window go to File->Open and open a file called Microsoft Office\Office\MSword8.olb for MS Word 97 or ...Microsoft Office\Office\Excel8.olb for MS Excel 97.
Once the file has been "opened" there are three frames:
Automation Objects.
COM Objects.
and
Methods/Properties/Events.
If you select any COM Object or Method/Properties/Events and press "F1" key you will see the Microsoft Help (VBA) about the methods (to be able to see this help it is necessary to have a MS Office complete installation or a custom installation having selected the VBA help).
In the "progress syntax" frame the syntax that you have to use in 4GL for that Method/Property/Event selected is displayed.
Also if you have installed the VBA component with MS Office or performed complete installation (recommended) you can do the following:
When you want to code something in 4GL against MS Word (or Excel), first you open MS Word and record a macro (Tools menu-> Macro->Record New Macro... Macro1).
Then perform the task you would like to do through 4GL and once you have finished go to Tools->Macro->Stop Recording.
Now you have recorded all the internal commands that MS Word uses to perform all the tasks that you did when recording the macro. These commands are very similar to the 4GL commands.
Now you have to see these Word commands within the macro just recorded. To see them go to Tools->Macro->Macros... select the macro (macro1) and click on the Edit button. You will see the commands then.
With this, the COM Object Viewer and some imagination and time it is possible to code the 4GL commands.