I am trying to handle navigation complete event (ie_NavigateComplete2) in Excel VBA, it is called when the website is not in Local Intranet or Trusted sites of IE Security settings but not otherwise.
here's the code:
Option Explicit
Dim WithEvents ie As InternetExplorer
Sub start_here()
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate "https://www.example.com"
While ie.busy
DoEvents
Wend
End Sub
Private Sub ie_NavigateComplete2(ByVal pDisp As Object, url As Variant)
' this is not called if "https://www.example.com" is in trusted or local sites in IE security setting
MsgBox "navigatecomplete2"
End Sub
How to circumvent this problem?