General discussion

Locked

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.

Ray

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| 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!"
End
EndIf

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
Endif

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.

http://www.tek-tips.com/faq.cfm?spid=222&page=1&CFID=3714227&CFToken=43607892#61

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.

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums