Article

Tips for using Excel and Word via ActiveX Automation

« Go Back

Information

 
Article Number000020858
EnvironmentProduct: Progress, OpenEdge
Version: All supported versions
OS: All supported platforms
Other: ActiveX
Question/Problem Description
Tips for using Excel and Word via ActiveX Automation
How to learn what methods and properties are available for an ActiveX object
How to use the Progress COM Object Viewer
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
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.
Workaround
Notes
Microsoft has changed shipping of libraries for Excel .olb from 2010 versions because they started stuffing .olb file into the executables. So need to import the type library directly from Excel.exe.
Please find the below reference from the internet. 

http://social.msdn.microsoft.com/Forums/office/en-US/38d560d9-dc79-43ee-b2f9-c72f8146c8fd/nightmare-with-excel-2010
Attachment 
Last Modified Date4/12/2016 1:57 PM


Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025