Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing to see if an application is running

Status
Not open for further replies.

JamesBBB

Technical User
Nov 2, 2005
74
0
0
GB
Hi all,

I am trying to write a small procedure to check if an application is running. I have found some code that MS states runs in VB but I cannot get it to run in Access 2003.

This what I've found for VB, which i tried placing in the modules section

Code:
Declare Function GetModuleHandle Lib "KERNEL" (ByVal App As String) _
    As Integer

Sub IsAppRunning()

Dim Response As Integer

   'Call the GetModuleHandle function to determine if Microsoft
   'Word is currently running

   Response = GetModuleHandle("Winword")

   'If Response is 0, then Word is not running. If Response is
   'nonzero, then Word is running.

   If Response = 0 Then
       MsgBox "Application is not running"
   Else
       MsgBox "Application is running"
   End If
End Sub

But I cannot get it to run in access. Can anyone please help.

Many thanks

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top