![]() |
Close an application with sendkeys
Hello,
This is my code to open my program from excel; Public Sub OpenPLaunchShell() On Error GoTo Err_PLaunch Dim strappPack As String Dim BoPack As Boolean On Error Resume Next strappPack = "C:\Program Files\PLaunch\PLaunch.exe" If Err < 0 Then BoPack = True ' if no error PLaunch is open Err.Clear MsgBox "PLaunch is not open" Call Shell(strappPack, 2) AppActivate strappPack Exit Sub Else Exit Sub MsgBox "Found PLaunch open" End If 'Exit from the code ExitCode: Exit Sub 'Error Handler Err_PLaunch: MsgBox Err.Description Resume ExitCode End Sub This is the sub to close my program; but the problem is that I close the visual studio when I try to execute this code: Sub ClosePLaunch() Dim strappPack As String strappPack = "C:\Program Files\PLaunch\PLaunch.exe" 'Close PLaunch SendKeys "%{F4}", True DoEvents End Sub Someone has any suggestion how to close an application on sending the Alt+F4 key. Ina |
Close an application with sendkeys
If you know the Windows Handle of your application (Use the FindWindow API),
you can close it using the SendMessage or PostMessage API call. |
Close an application with sendkeys
Thank you I used the createobject and now it is fine. but the program
open twice and I do not know why Ina |
All times are GMT +1. The time now is 06:52 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com