Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA - IE GetElementByID not working

I'm having some trouble with entering a text in a search box when after I what I think to be the correcet ID tag is. I got the ID from the page's source code. I've done this before with other websites. Can someone please help me out? Is there another 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 a "Automation Error The Object invoked has disconnected from its clients"

Source Code where I pulled the ID 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>
like image 437
Andy Caster Avatar asked Mar 06 '13 20:03

Andy Caster


1 Answers

If you use Set IEexp = New InternetExplorerMedium you don't have to change the settings in your Internet Options. It automatically instantiates the IE object with Medium Integrity Application settings.

like image 129
cyphi1 Avatar answered Sep 28 '22 00:09

cyphi1