Macro to Test Whether Windows Application Is Loaded

ID: Q59296


The information in this article applies to:
  • Microsoft Excel for Windows, versions 2.x, 3.0, 4.0, 5.0


SUMMARY

The following command macro tests to see if a Windows application is currently loaded without activating the application.

The macro code is as follows, starting in cell A1 of the macro sheet:


   A1: IsAppLoaded
   A2: =REGISTER("KERNEL","GetModuleHandle","IC")
   A3: =CALL(A2,B1)
   A4: =RETURN() 


In this example, the name of the application being referenced is kept as text in cell B1. If the application is loaded, a nonzero value is returned in cell A3. If the application is not loaded, A3 contains 0 (zero).

Note that the application name in cell B1 should be in the form of the name of the application executable without the .EXE or .COM extension. For example, the correct text to test for Microsoft Word for Windows is "WINWORD" (without the quotation marks).

Note: the information above also applies to version 5.0 only when using version 4.0 macro language.

Additional query words: 2.0 2.00 2.01 2.1 2.10 3.0 4.0 5.0 check running

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: March 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.