Microsoft KB Archive/68325

Macro to Run Word for Windows Macro in Excel

PSS ID Number: Q68325 Article last modified on 08-17-1992

1.00 1.10 1.10a 2.00 2.00a WINDOWS

Summary: The following macro allows versions 3.0 and 4.0 of Microsoft Excel for Windows to run a Microsoft Word for Windows macro. This macro is provided as an example only and should be tested only on files that have been backed up. The macro does the following tasks: - Creates a DDE link to Word for Windows (the server) from Excel (the client). - Runs the Word for Windows AppMaximize statement to view the macro running. - Runs the Word for Windows FileOpen command. - Runs the Word for Windows MacroRun command. - Terminates the DDE link.

Sample Macro
For version 2.0 or 2.0a of Word for Windows, use the following macro: =EXEC(“winword.exe”,2) =INITIATE(“winword”,“system”) =EXECUTE(A3,“[appmaximize]”) =EXECUTE(A3,“[fileopen(&quot;&quot;agenda.doc&quot;&quot;)]”) =EXECUTE(A3,“[toolsmacro .name = &quot;&quot;test&quot;&quot;, .run]”) =TERMINATE(A3) =RETURN For version 1.x of Word for Windows, use the following macro: =EXEC(“c:.exe”,2) =INITIATE(“winword”,“system”) =EXECUTE(A3,“[macrorun &quot;&quot;appmaximize&quot;&quot;]”) =EXECUTE(A3,“[fileopen(&quot;&quot;c:.doc&quot;&quot;)]”) =EXECUTE(A3,“[macrorun &quot;&quot;Macro_to_Run&quot;&quot;]”) =TERMINATE(A3) =RETURN In these samples, the cell that holds =INITIATE is A3. If this changes, replace A3 with the correct location of the =INITIATE command.

Additional reference words: 1.00 1.10 1.10a 2.00 2.00a w4wmacro