Insert Value Into Web Form (Frustrating) (1 Viewer)

abbaddon223

Registered User.
Local time
Yesterday, 19:14
Joined
Mar 13, 2010
Messages
162
Hi,

I'm trying to put a value into two fields in a web form. The code I'm using is:

Dim ie As Object
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True

ie.navigate "URL HERE"

While ie.Busy
DoEvents
Wend
While ie.Document.ReadyState <> "Complete"
DoEvents
Wend

ie.Document.getElementByID("phone_login").Value = "XXX"

I've also tried getElementByName too with no joy. Can anyone see what I am doing wrong please? :banghead:

/></td><td align="center" valign="middle"> phone login </td></tr>
<tr><td align="left" colspan="2"><font size="1">   </font></td></tr>
<tr><td align="right">Phone Login: </td><td align="left"><input type="text"

name="phone_login" size="10" maxlength="20" value="" /></td></tr>
<tr><td align="right">Phone Password: </td><td align="left"><input type="password" name="phone_pass" size="10" maxlength="20" value="" /></td></tr>
 

James Dudden

Access VBA Developer
Local time
Today, 02:14
Joined
Aug 11, 2008
Messages
369
Try this:
ie.Document.all.Item("phone_login").Value = "XXX"
 

James Dudden

Access VBA Developer
Local time
Today, 02:14
Joined
Aug 11, 2008
Messages
369
Also think you might need to add the name to the ID of the element like this:

<input type="text" id="phone_login" name="phone_login" size="10" maxlength="20" value="" />
 

abbaddon223

Registered User.
Local time
Yesterday, 19:14
Joined
Mar 13, 2010
Messages
162
What a living legend!!! Thanks so much for that help.

Could I ask for a little more help please?

Now I have a dropdown box (on the web page) which I'd like to populate with a value. From the looks of things, the combo box only allows / shows it's input values when it get's focus.

Am I able to insert my value into this combo in a similar way? I tried and it would not allow it (as I suspect I have not given it focus).

Thanks so much again for your help.

<tr><td align="right">Campaign: </td><td align="left"><span id="LogiNCamPaigns"><select size="1" name="VD_campaign" id="VD_campaign" onfocus="login_allowable_campaigns()">
 

abbaddon223

Registered User.
Local time
Yesterday, 19:14
Joined
Mar 13, 2010
Messages
162
James - thanks for both comments - I've got the combo box to refresh just by placing focus on it as your link showed

ie.Document.all.Item("VD_campaign").focus

I'm going to open a seperate thread regarding putting the info into the combo box. Thanks again!!
 

Users who are viewing this thread

Top Bottom