Excel Macro to Determine If Word for Windows Is LoadedLast reviewed: February 5, 1998Article ID: Q94624 |
The information in this article applies to:
SUMMARYThe Microsoft Excel EXEC function can be used within an Excel macro to launch Word for Windows. However, if Word for Windows is already running, the EXEC function might launch another instance of Word for Windows (multiple instances of Word for Windows version 2.0 are possible if SHARE.EXE is loaded).
MORE INFORMATIONThe following Excel macro tests whether Word for Windows is currently running before using the EXEC function. The macro code begins in cell A1 of the macro sheet: IsAppLoaded =REGISTER("KERNEL","GetModuleHandle","IC") =CALL(A2,"winword.exe") =IF(A3<>0) =ALERT("Word is already running") =ELSE() =EXEC("winword.exe") =END.IF() =RETURN() Instead of the ALERT function, you can use DDE commands to begin and maintain a DDE conversation with Word for Windows. If the Word for Windows program directory is not on the MS-DOS path, indicate the full path to the Word for Windows executable. For example: =EXEC("C:\winword\winword.exe")
REFERENCES"Microsoft Excel Function Reference," version 4.0, page 138.
|
KBCategory: kbmacro
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |