How To Add and Run a VBA Macro Using Automation from MFC (194906)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q194906 SUMMARY
Developers occasionally need to call an Automation client, such as
Microsoft Excel, from another client, such as Microsoft Word, when
automating Word from a Visual C++ client application.
This article discusses an approach to using the Microsoft Foundation Class
(MFC) Library installed with Microsoft Visual C++ versions 5.0 and 6.0 to
add a VBA macro to Word from a Visual C++ client. The program also adds two
CommandBar Control buttons to Word's CommandBars: one to run the macro,
instantiating Excel, and one to close Excel. The program also removes the
macro from Word, and closes Word.
REFERENCES
For additional information, please see the following articles in the
Microsoft Knowledge Base:
178749
How To Create an Automation Project Using MFC and a Type Library
180625
How To Use Automation to Modify the Office Menu
| Modification Type: | Minor | Last Reviewed: | 3/21/2005 |
|---|
| Keywords: | kbAutomation kbcode kbhowto kbinterop KB194906 |
|---|
|