'using webbrowser_v1 instead of webbrowser object. Webbrowser_v1 allows us to use the popup window event which is not available in webbrowser event

Dim WithEvents IE As InternetExplorer

Private Sub StartIE
Set IE = CreateObject("InternetExplorer.Application.1")
IE.Visible = True
End Sub
'You have to create the Internet Explorer object with the WithEvents keyword, which lets you 'hook its events in your code. Next, you can hook this object's NewWindow2 event:
Private Sub IE_NewWindow2(ppDisp As Object, Cancel As Boolean)

Set IEx = CreateObject("InternetExplorer.Application.1")

Set ppDisp = IEx
IEx.Visible = True

End Sub

Comments

Popular Posts