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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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