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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help closing an external app with Shell() 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
The following code opens up an external VB.NET app. How do I close the same application with VBA code? Do I use the Shell command again or do I use some kind of system process?

Dim CommandLine As String
CommandLine = "C:\DocMan\Welcome.exe"
Call Shell(CommandLine, 1)

Steve728
 
You may try something like this:
Code:
...
Dim TaskID
TaskID = Shell(CommandLine, 1)
'
' some stuff here
'
' It's now time to close the launched app
AppActivate TaskID
SendKeys "%{F4}", True
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top