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: 11
Default Closing IE windows from VBA

Hi

accroding to my post from yesterday, I found this....

It should close all IE windows, and is close to what I tried.

The problem is SendMessage HWnd, WM_CLOSE, 0&, 0&
It gives a ding (like for a confirmation or warning), I guess that
something blocks it, so it is not allowed to close.

I tried other messages, WM_DESTROY and WM_QUIT, same result... or
actually none, they do not even give a ding.

Why can I not close that window?
I should mention, that I create it myself using shellexecute and wait
7 secs. So the window is open and ready.


WBR
Sonnich



Public Declare Function FindWindow Lib "user32" Alias
"FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
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 Const WM_CLOSE As Long = &H10
Public Const IE_WINDOW_CLASS = "IEFrame"

Dim HWnd As Long
HWnd = FindWindow(IE_WINDOW_CLASS, vbNullString)
Do Until HWnd = 0
SendMessage HWnd, WM_CLOSE, 0&, 0&
HWnd = FindWindow(IE_WINDOW_CLASS, vbNullString)
Loop

 
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
closing file with multiple windows open gvanhoy3 Excel Worksheet Functions 1 November 15th 06 06:31 PM
Warning the user about closing Windows:1. Walden2 Excel Programming 1 November 15th 06 06:33 AM
Closing Windows Sameer Excel Discussion (Misc queries) 3 October 26th 06 10:48 AM
Prevent open excel windows from automatically closing. Prevent Automatic Closing Excel Discussion (Misc queries) 1 April 10th 06 10:27 PM
closing active windows without saving changes Tony Excel Programming 2 March 26th 05 10:24 PM


All times are GMT +1. The time now is 12:53 PM.

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

About Us

"It's about Microsoft Excel"