Paulo Bueno
Paulo Bueno

Reputation: 2569

close pop-up window using shdocvw?

I used to close pop-up windows in VBA using the following code:

    Dim k As New shdocvw.ShellWindows   ' close menu window
    Dim c As WebBrowser
    For Each c In k
    If c.LocationURL = "http://specificsite.com/x.html" Then c.Quit()
    Next

You can see I have to check if the pop-up was opened and then close it.

I've migrated to VB.NET e2010 and it doesn't work.

I've found how to handle events and use the NewWindow to cancel the opening of the pop-up.

Unfortunately by cancelling instead of closing after it was opened, it causes a script error by JavaScript on the main page.

How can this be solved?

Upvotes: 2

Views: 2041

Answers (1)

Nivid Dholakia
Nivid Dholakia

Reputation: 5452

I was working on similar kind of project that i used shdocvw you can find it here

You could also find this one helpful this is using c# but you can convert it into VB Click Here

Upvotes: 1

Related Questions