Home > Back-end >  Excel VBA InternetExplorer.document - Automation/unspecified error
Excel VBA InternetExplorer.document - Automation/unspecified error

Time:07-29

I am new to the wonderful world of excel VBA. I am trying to scrape some data from our company page. As you can see in the picture I get the Automation/unspecified error. Any ideas? It does not matter which page I open, once I start to use the document it leads to errors.

Sub PMM()
    
    'declaration
    Dim ie As InternetExplorer
    Dim ht As HTMLDocument
    Dim UserName As String, Password As String, LoginData As Worksheet
    Set LoginData = ThisWorkbook.Worksheets("Sheet1")
    UserName = LoginData.Cells(1, "B").Value
    Password = LoginData.Cells(2, "B").Value
    
    'Inicialization
    Set ie = New InternetExplorer
    ie.navigate ("http://czpskmii0021.ls.ege.ds:50000/XMII/CM/SC_MAINTENANCE/Report/WorkOrderList.irpt")
    document = ie.document.getElementById("logonuidfield")
    'Set ht = ie.document
    'ht.getElementById ("logonuidfield")


End Sub   

enter image description here

CodePudding user response:

Fixed it by changing the Internet options -> Security -> Enable Protected Mode

Protected mode

  • Related