Window.open() or similar IE command

tightwad

Well-known Member
Joined
Feb 22, 2006
Messages
609
I get this error when I am working with IE and I submit a form that auto-closes the IE window:

"The webpage you are viewing is trying to close this window

Do you want to close this window?"

I DO want to, but I don't want it to ask me about it. I read that if the window is opened using Window.Open() it works, but this is for Java-script. Is there a similar command for VBA?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hmm, wondering what code you might be using... this works for me w/o the pop-up:

Code:
sub test()
'reference: Microsoft Internet Controls 
    'reference: Microsoft HTML Object Library 

    Dim mIE As InternetExplorer 
        
    Set mIE = New InternetExplorer 
    
    mIE.Visible = True 
    
    mIE.Navigate "www.yahoo.com" 

    mIE.Quit

   Set mIE = Nothing
end sub
 
Upvote 0
BTW: Here is the article I referenced for manipulating IE... not complete, but more than enough to be dangerous.
 
Upvote 0
I only get the error because there is a submit button on the web form which closes the window. It doesn't give the warning normally because it is opened not as the main window.

I used the same references you did...I will try to find a public example I can share.
 
Upvote 0
Hmmm... you know, I had a similar problem with an Internet Security popup... and I ended up using WinApi calls to find the handle of the window, then find the handle of the button, then send a mouseclick event to the button. You may want to do something similar... I see a couple of things to balance, but I alsready pulled many of the components together for other aspects of my app, and I woul dbe happy to share, if you are interested in exploring this option.

Here is the thread where I originally asked the question... though I think it is just the first part of what you would probably need to do.
 
Upvote 0
Hatman

Check this <a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
">link</a>.
 
Upvote 0
Norie... that's not getting me to the article, only to the MSDN Library Start Screen... exactly what are you pointing me to?
 
Upvote 0
It's not meant to get you to any article.

It's just a link to the object model/reference for DHTML/HTML.

I've found it very useful in the past.

I realise it doesn't quite cover automation but there's plenty of useful info there.
 
Upvote 0
From what I can tell in my current situation, the problem is with how the window is created. If it is created correctly, it doesn't require a close window OK.
 
Upvote 0

Forum statistics

Threads
1,214,377
Messages
6,119,185
Members
448,872
Latest member
lcaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top