Hi, I've been having problems getting NewWindow2 and BeforeNavigate2 to cancel in the following vb script. I've had the same problems with jscript. I'm not really sure why this doesn't work. Another question I had was how to unadvise on quit. I've been running this using wscript. Is there something wrong with this code? Thanks a lot.
Code:
Set IEobject = WScript.CreateObject("InternetExplorer.Application","IEobject_")
IEobject.Visible = True
IEobject.Navigate2 "[URL unfurl="true"]http://www.google.com"[/URL]
Do While IEobject.Visible
WScript.Sleep 500
Loop
Sub IEobject_BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel)
Wscript.Echo "Going to:", URL
Cancel = True
End Sub
Sub IEobject_NewWindow2(pDisp, ByRef Cancel)
Cancel = True
End Sub