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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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.
 
Upvote 0

Forum statistics

Threads
1,214,405
Messages
6,119,320
Members
448,887
Latest member
AirOliver

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