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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
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
 

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
BTW: Here is the article I referenced for manipulating IE... not complete, but more than enough to be dangerous.
 

tightwad

Well-known Member
Joined
Feb 22, 2006
Messages
609
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.
 

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664

ADVERTISEMENT

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.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Hatman

Check this <a href="http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp
">link</a>.
 

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664

ADVERTISEMENT

Norie... that's not getting me to the article, only to the MSDN Library Start Screen... exactly what are you pointing me to?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
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.
 

tightwad

Well-known Member
Joined
Feb 22, 2006
Messages
609
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.
 

Forum statistics

Threads
1,136,423
Messages
5,675,765
Members
419,585
Latest member
popsin

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
Top