Web Development

General discussion


Excel97 & VBA: verify another app is ru

By web maxtor ·
Using Excel97, I need to verify another application is running before attempting a DDE link to it. I want to avoid the Windows dialog prompting the user to start the app when the DDEInitiate fails.

I imagine App.PrevInstance will work, but can'tfind an implementation example.

Examples, or better ideas, are greatly appreciated.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Excel97 & VBA: verify another app is ru

by tclere In reply to Excel97 & VBA: verify an ...

The App.PrevInstance will only check if the current application is already running. This will prevent a user opening 2 instances of the same application.

If App.PrevInstance = True Then
MsgBox App.Title & " is already running!"

If you want to see if a different application is running you have a couple choices. If the app has a window opened you can just look for the window, assuming you know the title.

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

hwnd = FindWindow(vbNullString, sAppTitle) 'sAppTitle: "Title of Window"

If hwnd <> 0 Then
'You Found it
'Do your Stuff

If the app does not have a window opened but it shows in Task Manager, I have posted a solution here that can be modified to suit your needs.


Let me know if you need more info.

Collapse -

Excel97 & VBA: verify another app is ru

by web maxtor In reply to Excel97 & VBA: verify an ...

Works great. Thanks.

Related Discussions

Related Forums