Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you know the Windows Handle of your application (Use the FindWindow API),
you can close it using the SendMessage or PostMessage API call. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you I used the createobject and now it is fine. but the program
open twice and I do not know why Ina |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
The application SendKeys | Excel Programming | |||
SendKeys and Application.ScreenUpdating | Excel Programming | |||
Close Dialog Box with SendKeys | Excel Programming | |||
SendKeys to a remote server application | Excel Programming | |||
Application.sendkeys | Excel Programming |