LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Peter Huang, Vasant, Chip Pearson - Close External Application VBA - ZABU

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thank you Chip Pearson Michael Excel Discussion (Misc queries) 3 February 5th 05 08:35 PM
Question to Chip Pearson Doug[_9_] Excel Programming 2 January 19th 04 03:56 PM
Chip Pearson Ricardo[_2_] Excel Programming 0 November 10th 03 07:51 PM
CHIP PEARSON - THANX bertieBassett Excel Programming 0 November 3rd 03 02:01 PM
Chip Pearson or someone Chip Pearson Excel Programming 3 September 18th 03 05:22 AM


All times are GMT +1. The time now is 02:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"