Excel: How to Run a Word for Windows Macro from ExcelLast reviewed: September 13, 1996Article ID: Q94364 |
The information in this article applies to:
SUMMARYIn Microsoft Excel for Windows, you can use the EXECUTE() function to run version 2.0 Microsoft Word for Windows macros in a dynamic data exchange (DDE) macro.
MORE INFORMATIONMicrosoft provides macro examples for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This macro is provided 'as is' and Microsoft does not guarantee that the following code can be used in all situations. Microsoft does not support modifications of the code to suit customer requirements. The following is a sample macro that runs a Microsoft Word for Windows macro called TEST from Microsoft Excel. In order to run this macro, use the WordBasic command ToolsMacro in the EXECUTE() function.
A1: =INITIATE("winword","system") A2: =EXECUTE(A1,"[ToolsMacro.Name=""TEST"",.Run]") A3: =TERMINATE(A1) A4: =RETURN()For more information about the ToolsMacro function choose Help Index from the Help menu in Word for Windows, search on WordBasic, select WordBasic Programming Language, choose the Go To button, and select ToolsMacro from the list of WordBasic functions and statements.
Explanation of MacroA1: Initiates the channel to Word for Windows. A2: Executes the ToolsMacro WordBasic command to run the macro called "TEST". NOTE: The two quotation marks on each side of the macro name are required to produce the one set of quotation marks needed by Word.A3: Terminates the DDE channel to Word for Windows. A4: Ends the macro.
REFERENCES"Function Reference," version 4.0, pages 139-140 "Function Reference," version 3.0, pages 71-72
|
KBCategory: kbinterop
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |