none
Internet Explorer - IE.Document is empty RRS feed

  • Question

  • I upgraded to Internet Explorer 11 recently. But after that, below macro code stop working while getting getElementById , I checked and found that IE.Document is showing empty (No Variables) in Watch window.

     
      Dim IE As Object, ElementCol  As Object
        Dim objElement As Object, Link As Object
        Dim objCollection As Object
        Dim objNS As Outlook.Namespace, strUserName As String
    
        On Error GoTo ErrorHandler 
    
        Set objNS = Outlook.GetNamespace("MAPI")
    
        strUserName = objNS.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress
    
        Set IE = CreateObject("InternetExplorer.Application")
    
        IE.Visible = True
    
        IE.Navigate "http://www.example.com/" 
    
        Set objCollection = IE.Document.frames(1).Document
    
        objCollection.getElementById("userid").Value = strUserName
        objCollection.getElementById("password").Value = mdlSettings.strPasssword
    
        objCollection.getElementById("submit1").Click
    
        Call Wait(IE)
    
        Set ElementCol = IE.Document.frames(1).Document.getElementsByTagName("a")
        Call ClickHyperLink(IE, ElementCol, "Time Management")
    
        Set ElementCol = IE.Document.frames(1).Document.getElementsByTagName("a")
        Call ClickHyperLink(IE, ElementCol, "Timesheet Entry")
    
        Set ElementCol = IE.Document.frames(1).Document.getElementsByTagName("a")
        Call ClickHyperLink(IE, ElementCol, "<STRONG><U>Detail View</U></STRONG>")
    
        IE.Visible = True
    
        Set IE = Nothing
        Set objElement = Nothing
        Set objCollection = Nothing
    
        Application.Wait DateAdd("s", 5, Now)
    
        ThisWorkbook.Close SaveChanges:=False
    
        Exit Sub
    ErrorHandler:
        MsgBox "Error " & Err.Description & " " & Err.Number

                                                                

    Monday, October 13, 2014 9:47 AM

All replies

  • Did you ever figure this out? I'm having the same issue.
    Friday, October 28, 2016 8:06 PM
  • It seems putting the site in 'Compatibility Mode' works. Although Compatibility Mode does not work we recaptcha which I require. 
    Thursday, March 21, 2019 4:50 PM
  • Starting with IE 11 I've never gotten MS Internet Controls to work properly.  I consider IE to be dead.  Even MS recommends you don't use it.

    There is a program called SeleniumBasic.  It is capable of controlling Edge using the stand-alone webdriver.  Starting with Windows 10 1809 it doesn't offer a stand-alone webdriver.  It delivers webdriver with Windows 10 in System32 directory.  SeleniumBasic doesn't work with it. 

    If you update the Chrome driver in SeleniumBasic it works.

    You can use a different language like C# and get Selenium to work.

    Saturday, March 23, 2019 9:09 PM