VBA Access fill TextBox in Internet Explorer

MyTech

Access VBA
Local time
Yesterday, 23:58
Joined
Jun 10, 2010
Messages
108
Can anybody please help me?

In MS Access, I'm trying to open IE, navigate to Google.com and set my text in the text box.
I don't know why it's not going.

I used:
---
Function OpenIE()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.Navigate "http://www.google.com/"
While ie.busy
DoEvents
Wend
ie.Document.getElementById("q").Value = "My Search Text"
End Function
---


The webpage is opening but the text is not being entered. An I got an error message


Using Windows 7 - IE9 - Office 2010

I got following error:

---
Run-time error '424':
Object required
---


Using Windows Vista SP2 - IE8 - Office 2007

I got following error:

---
Run-time error '-2147467259 (80004005)':
Method 'Document' of object 'IWebBrowser2' failed
---

The error is for the last line:
" ie.Document.getElementById("q").Value = "My Search Text" "
 
I'm using Acc2003, XP sp3 , IE 6.0 ---- your code works for me.
 
are you sure the document is fully loaded by the time the code gets to that line? ie.busy is extremely unreliable. 'ie.readystate' is more reliable, but it also fails randomly. controls populate on the page last (I think). ie.busy can return false as early as the point at which the server starts sending information to the browser. in that case, the tbox population would most certainly fail.

I believe Iwebbrowser2 is part of the WinInet dll, isn't it?
 
"Readystate" didn't help either.

I'm not as pro to be able to answer on the "Iwebbrowser2 is part of the WinInet dll" question.


Wondering if there's anybody able to solve the mystery ... t'would be greatly appreciated.
 
Should I guess that Vista and Windows 7 are the problem???
 
Your code is working fine on

Vista Home Basic SP2
IE 8
Acc2003
 

Users who are viewing this thread

Back
Top Bottom