Sub AutomateCHALLAN1()
Dim ws As Worksheet
Dim IE As Object
Dim frmTax As Object
Dim doc As Object
Dim opt As Object
Dim ws1 As Worksheet
Dim drop As Integer
Set ws = Worksheets("ITNS 281")
Set ws1 = Worksheets("ReqFieldValue")
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.Navigate ("https://onlineservices.tin.nsdl.com/etaxnew/tdsnontds.jsp")
Do While IE.Busy: DoEvents: Loop
Do While IE.ReadyState <> 4: DoEvents: Loop
Set doc = IE.Document
Set ctl = doc.getElementById("281")
ctl.FireEvent ("onclick")
Set doc = IE.Document
Do While IE.Busy: DoEvents: Loop
Do While IE.ReadyState <> 4: DoEvents: Loop
Set frmTax = doc.forms(1)
Set opt = frmTax.Item("MajorHead")
Select Case ws.Range("W1")
Case 1
opt.Item(1).Checked = True
Case 2
opt.Item(0).Checked = True
End Select
frmTax.Item("TAN").Value = ws1.Range("D3").Value
frmTax.Item("Name").Value = ws1.Range("D4").Value
For drop = 0 To frmTax.Item("AssessYear").Length - 1
frmTax.Item("AssessYear").Options.selectedindex = drop
If LCase(frmTax.Item("AssessYear").Options(drop).FirstChild.Data) = ws1.Range("D5").Value Then
Exit For
End If
Next
frmTax.Item("Add_Line1").Value = ws1.Range("D6").Value
frmTax.Item("Add_Line2").Value = ws1.Range("D7").Value
frmTax.Item("Add_Line3").Value = ws1.Range("D8").Value
frmTax.Item("Add_Line4").Value = ws1.Range("D9").Value
frmTax.Item("Add_Line5").Value = ws1.Range("D10").Value
For drop = 0 To frmTax.Item("Add_State").Length - 1
frmTax.Item("Add_State").Options.selectedindex = drop
If LCase(frmTax.Item("Add_State").Options(drop).FirstChild.Data) = LCase(ws1.Range("D11").Value) Then
Exit For
End If
Next
frmTax.Item("Add_PIN").Value = ws1.Range("D12").Value
'IE.Quit
End Sub
|