Results 1 to 4 of 4

Thread: Are Word/Excel Running?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Location
    Dublin
    Posts
    30
    Can anybody please give me the code for the following;

    I want to know if MS Word is running.
    I want to know if MS Excel is running.

    Thanks,

    Graham.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Dim nHandle As Long

    ' If Excel is running this API call returns its handle.
    nHandle = FindWindow("XLMAIN", 0) 'use "WINWORD" for Word

    If nHandle = 0 Then ' 0 means Excel not running.
    'do something here
    End If


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Location
    Dublin
    Posts
    30
    Thanks for the code but can I confirm..

    Is 'FindWindow' a VB command or is it a C+ command as I am getting a Sub or Function not defined.

    Thanks
    Graham.

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    FindWindow is part of the Windows API:

    Declare Function FindWindow Lib "user32" Alias _
    "FindWindowA" (ByVal lpClassName As String, _
    ByVal lpWindowName As Long) As Long

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width