Hi everyone,
I was wondering if you could help me. I know very little about excel and macros, but I am trying to create a macro that will auto-populate a web form based on the text that appears in specific cells. I found a video on youtube that does just this, but I keep coming up against Run-time error '-2147467259 (80004005) - Method 'Document' of object 'IWebBrowser2' failed. For background, this is auto-populating on a corporate intranet webpage.
Here is my code:
Sub FormAutomation()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "web address"
IE.Visible = True
While IE.Busy
DoEvents
Wend
IE.Document.All("xxxxxxx").Value = ThisWorkbook.Sheets("sheet2").Range("a1")
End Sub
----
So, two questions:
1. How do I resolve this error so that the macro works?
2. There are multiple text fields that are being auto-populated, not just a1 - do I add the same statement multiple times
IE.Document.All("xxxxxxx").Value = ThisWorkbook.Sheets("sheet2").Range("a1")
and replace the cell number (a1 in this case)?
Also, if this method is incorrect and you know of an easier way to make this work, please feel free to share that with me, it's greatly appreciated!
Thanks in advance for your help!
Bookmarks