I shortened the code for better visibility:
Sub open_explorer()
'Open Website 1
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ("https://www.google.ch/search?newwindow=0&q=Dodecan+Sigma-Aldrich")
IE.Visible = True
i = 0
Do
Wait
i = i + 1
Loop Until IE.ReadyState = 4 Or i > 10
Set dom = IE.document
Debug.Print (dom)
Debug.Print (dom.anchors.Length)
'Open Website 2
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate ("https://www.sigmaaldrich.com/catalog/product/sial/457116?lang=en®ion=US")
IE.Visible = True
i = 0
Do
Wait
i = i + 1
Loop Until IE.ReadyState = 4 Or i > 10
Set dom = IE.document
Debug.Print (dom)
Debug.Print (dom.anchors.Length)
End Sub
Sub Wait()
Application.Wait (Now + TimeValue("0:00:01"))
End Sub
As you can see the Sub open_explorer
opens two websites and tries to read its DOM. However while the code perfectly works for the first website it doesn't for the second although the code is the same. Any Ideas why it doesn't work for the second website?