Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Peter, Vasant or Chip:
I have finally tested the code discussed in prior posts regarding closing an external application with VBA Code. I have successfully executed the "Send and Wait" command for the "Calc.exe" Test use of API calls and monitoring. Once the program is clsoed a message appears, which communicates that the program has been closed. I am currently at the following step and am having diffuculty. I need to find a particular window and close the application associated with the window after a search and data transfer to excel (this will occur about 30 times, so this many windows will have to be closed). I have reviewed the following code from Chip Pearson (I believe), but am having difficulty. I believe that I need to find the specific classname and window name associated with the "FindWindowA" function. This is shown in the code below, but I cannot get it to execute. Please send any informatin that may assist in my efforts. Example code will be very useful! Many thanks in advance! Kind Regards, ZABU Code located on the Google Groups: Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal HWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Const WM_CLOSE = &H10 Public Const WM_DESTROY = &H2 Public Const WM_NCDESTROY = &H82 Sub CloseWindow() Dim HWnd As Long 'Dim lpClassName As String 'Dim lpWindowName As String HWnd = FindWindow("CabinetWclass", "Baytek WinBLISS") If HWnd 0 Then SendMessage HWnd, WM_NCDESTROY, 0, 0 End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Thank you Chip Pearson | Excel Discussion (Misc queries) | |||
Question to Chip Pearson | Excel Programming | |||
Chip Pearson | Excel Programming | |||
CHIP PEARSON - THANX | Excel Programming | |||
Chip Pearson or someone | Excel Programming |