When using the WebBrowser control, is it possible to cause popup windows to
appear within the WebBrowser control itself instead of a new window?
This is what I've written in the NewWindow2 event, but I can't figure out
how to get the popup to appear in the same browser window.
In this code the user is presented with "Yes", "No" or "Cancel". Yes allows
the popup to spawn a window, No should load the popup in the same window and
Cancel should just not show the popup at all.
....also, is it possible to determine the URL that the popup is trying to
load, so it can be included in the MsgBox prompt?
'
'New window is wanting to be created
'
Private Sub web_NewWindow2(ppDisp As Object, Cancel As Boolean)
Dim Resp As Long 'Holds users response
'Ask user what to do with popup window
Resp = MsgBox("Allow popup to open a new window?", vbYesNoCancel,
"Window Popup")
Select Case Resp
Case vbNo 'No, keep in same window
'Set Display object to our current web browser object (Doesn't
work)
Set ppDisp = web.object
Case vbYes 'Yes, let new window open
Case vbCancel 'Cancel, don't open popup window
Cancel = True
End Select
End Sub