Problem while filling a web form

shiva1234

New Member
Joined
Jun 3, 2018
Messages
2
I am new to VB and tried this code to fill a web form and it did not work (ie the web opened but was unable to fill in the fields) . Can some one please help me ...plssss. Following is the code:


Private Sub IE_Autiomation()

Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")

IE.Visible = True
IE.Navigate "https://onlineservices.tin.egov-nsdl.com/etaxnew/tdsnontds.jsp"


Do
DoEvents
Loop Until IE.readystate = 4


Set allhyperlinks = IE.document.getelementsbytagname("A")
For Each hyper_link In allhyperlinks
If hyper_link.innertext = "CHALLAN NO./ITNS 281" Then
hyper_link.Click
Exit For


End If


Next


Do
DoEvents
Loop Until IE.readystate = 3


Do
DoEvents
Loop Until IE.readystate = 4






Call IE.document.getelementbyname("Add_Line1").setattribute("Vale", "No.240")




End Sub
 

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.

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,750
Try changing the last line to:
Code:
IE.document.getElementsByName("Add_Line1")(1).Value = "240"
Note - the (1) is because there are 2 elements with name="Add_Line1", the first being a hidden input element. The same applies to Add_Line2, etc.

Please always use CODE tags when posting VBA code - the # icon in the message editor.
 

Watch MrExcel Video

Forum statistics

Threads
1,129,423
Messages
5,636,182
Members
416,904
Latest member
jaesun0802

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
Top