add value in textbox in webpage using vba

Ajinkya_1988

New Member
Joined
Mar 29, 2019
Messages
3
i am new to this forum. please solve my below query.
i want fill text box with my given value and click on search button. i cant provide the url as it will not work outside the office. i tried but getting object dose'nt support propery error and method.

text box inspect element is : <input type="text" size="40" name="agent" id="go" value="">

Search button inspect element is : <button type="submit">Submit</button>

below is my code:


Code:
Sub login_page()


Dim ieApp As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
'Dim ieApp As InternetExplorer
'Dim ieDoc As Object
'Dim ieTable As Object
'Dim clip As DataObject


'create a new instance of ie
Set ieApp = New InternetExplorer


'you don’t need this, but it’s good for debugging
ieApp.Visible = True


'assume we’re not logged in and just go directly to the login page
ieApp.navigate "http:"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop


Set ieDoc = ieApp.document


'fill in the login form – View Source from your browser to get the control names
With ieDoc.forms(0)
.user.Value = "id"
.Password.Value = "password"
.submit
End With


ieApp.navigate "http:"
Do While ieApp.Busy: DoEvents: Loop
'Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop


ieApp.navigate "http:"
Do While ieApp.Busy: DoEvents: Loop




ieApp.navigate "http:"
Do While ieApp.Busy: DoEvents: Loop


'Dim ie As HTMLInputElement
ieApp.document.parentWindow.execScript "****************='Go?action=agent'"


 ieApp.document.getElementsById("go").Value = "123"
 
  
 With ieApp.document
  .getElementById("go").Value = "123"
  
End With


ieApp.document.parentWindow.getElementsbyid("go").Value = "123"


 




ieApp.document.parentWindow.getElementbyid("go").Value = "123"




ieApp.document.getElementById("go").Value = "123"








End Sub
 
Last edited by a moderator:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,955
Latest member
BatCoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top