VBA - IE GetElementByID not working

I am having trouble entering text in the search box when after I think it is a proofreading identifier tag. I got the identifier from the source code of the page. I have done this before with other websites. Can someone please help me? Is there any other way to do this?

Sub FileUpload() Dim IEexp as Object IEexp.visible = True IEexp.Navigate ("www.example.com") 'this is where the problem IEexp.Document.GetElementByID("step1_id_bean_newSupportingDoc_description").Value _ = "monthly update" End Sub 

I get an error "Automation" An object is disconnected from its clients "

The source code where I pulled the identifier from:

 <td class="Label">Description</td> <td class="Data"><input type="text" name="bean.newSupportingDoc.description" size="60" maxlength="250" value="" id="step1_id_bean_newSupportingDoc_description" class="NoBorder"/> </td> 
+6
source share
3 answers

If you use Set IEexp = New InternetExplorerMedium , you do not need to change the settings in the Internet settings. It automatically creates an instance of the IE object with the settings of the application "Environmental Integrity".

+1
source

You can try

 Do Until IEexp.readyState = 4 DoEvents Loop IEexp.Document.getElementById("username").Value = "Monthly update" IEexp.Document.getElementById("password").Value = FilePth 
0
source

The code is working. How about a "protection mode"? See this article: http://www.sevenforums.com/tutorials/63141-internet-explorer-protected-mode-turn-off.html If your IE browser is in protection mode, try disabling it and running the code again.

 ' Add References: ' - Microsoft HTML Object Library ' - Microsoft Internet Controls Sub FileUpload() Dim IEexp As InternetExplorer Set IEexp = New InternetExplorer IEexp.Visible = True IEexp.navigate "www.example.com" Do While IEexp.readyState <> 4: DoEvents: Loop Dim inputElement As HTMLInputElement Set inputElement = IEexp.Document.getElementById("step1_id_bean_newSupportingDoc_description") If (Not inputElement Is Nothing) Then inputElement.Value = "monthly update" Else MsgBox "Input element not found on web page." End If IEexp.Quit Set IEexp = Nothing End Sub 
0
source

All Articles