1

I'am trying to run the below code in Explorer 11. It was running fine in Explorer 9/8 but I am getting this error when trying to run it in Explorer 11.

Run Time Error '424' object required

I think there is something missing but unable to get it. Please see below the part of code.

Sub Extract_StatusUS_test()

    Dim SheetName
    Dim a As InternetExplorer
    Dim OnlyPatNum
    Dim IEelement As Object

    OnlyPatNum = "7989466"
    Set a = New InternetExplorer
    a.navigate "http://portal.uspto.gov/external/portal/pair"
    a.Visible = True
    Do
    Loop Until a.readyState = READYSTATE_COMPLETE
    MsgBox ("Click OK after entering the re-captcha")
    Application.Wait Now + TimeValue("00:00:05")
    Do
    Loop Until a.readyState = READYSTATE_COMPLETE
    Application.Wait Now + TimeValue("00:00:04")
    Dim inp
    If Len(OnlyPatNum) > 7 Then
        For Each inp In a.document.getElementsByTagName("input")
            If UCase(inp.Title) = UCase("Publication Number") Then
                Application.Wait Now + TimeValue("00:00:01")
                inp.Focus
                inp.Click
                Exit For
            End If
        Next inp
    Else
        For Each inp In a.document.getElementsByTagName("input")
            If UCase(inp.Title) = UCase("Patent Number") Then
                Application.Wait Now + TimeValue("00:00:01")
                inp.Focus
                inp.Click
                Exit For
            End If
        Next inp
    End If
    Application.Wait Now + TimeValue("00:00:02")
    a.document.getElementById("number_id").Value = OnlyPatNum
    Application.Wait Now + TimeValue("00:00:02")
    a.document.getElementById("SubmitPAIR").Click
    Application.Wait Now + TimeValue("00:00:02")
    Do Until a.readyState = READYSTATE_COMPLETE
        DoEvents
    Loop
    Application.Wait Now + TimeValue("00:00:10")
    Set IEelement = a.document.getElementById("bibview")
    MsgBox IEelement.innerText

End Sub

I'am getting error in the line of code.

a.document.getElementById("number_id").Value = OnlyPatNum

I will appreciate if anyone will help.

Community
  • 1
  • 1
  • Check [this answer](http://stackoverflow.com/a/23232573/2165759) (replace `WScript.Sleep` there with `DoEvents` for VBA). – omegastripes Apr 07 '17 at 05:25
  • @omegastripes thanks for responding. By replacing the above mentioned the error has been resolve but the code still not running. Now it is give the below error in the same line of code. – Cheena Maheshwari Apr 07 '17 at 06:29
  • Run-Time error '91': Object variable or with block variable not set – Cheena Maheshwari Apr 07 '17 at 06:29
  • Have you made any changes to the code? If so please update the question and post the new code. – omegastripes Apr 07 '17 at 07:48
  • @omegastripes i did just small changes in the code as you told and updated it. I m unable to understand what is exactly the issue here as sometimes the line of code is not working or sometimes working and giving another error "Type Mismatch" in the line of code. Set IEelement = a.document.getElementById("bibview") – Cheena Maheshwari Apr 07 '17 at 10:19
  • Please read my first comment carefully. You may take solutions from that answer changing `WScript.Sleep` there to `DoEvents`. Not in your code. – omegastripes Apr 07 '17 at 11:23
  • I've made wrong code modification rollback due to misread. – omegastripes Apr 08 '17 at 07:54

0 Answers0