Results 1 to 2 of 2

Thread: Run-time Error

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2020
    Posts
    1

    Run-time Error

    Hi!

    I Can't get this code to work. When i run it i get a RUn-time error '-2147467259 (80004005)': Method 'Document' of object 'IWebBrowser2' failed.

    I seems to be something wrong with the row "Set doc = IE.document"

    I have Microsoft Internet Controls and Microsoft HTML Object Library in references.

    Can somebody help?

    See code below




    Sub test()

    Dim IE As Object
    Dim doc As HTMLDocument
    Set IE = CreateObject("InternetExplorer.Application")

    IE.Visible = True
    IE.Navigate "http://.........."

    Do While IE.Busy
    Application.Wait DateAdd("s", 1, Now)
    Loop

    Set doc = IE.document

    doc.getElementById("id-name").Value = "test"

    End Sub

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,807

    Re: Run-time Error

    Hello exkpwd, welcome to the forum!

    You, posted the question in the wrong forum, this is the correct forum: https://www.vbforums.com/forumdispla...ce-Development. You should also have mentioned your project was made using VBA in Excel and that it depended on the Microsoft HTML Object Library. Also, next time put your code in between code tags. You can get these tags by clicking the "#" button in the toolbar above the message you're about to post on the forum. I tried running your code and on my computer it doesn't throw that error. I am using Microsoft Excel 2013 on Windows 10 with Internet Explorer 11. What versions are you using?

    yours,
    Peter Swinkels

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width