Hi Bhupesh,
This worked for me. I am able to do the station search and get the train list. The code need to be tweaked to add some more parameters like date of search, quota type (Tatkal, General) etc. in case to be customized.
However, are we doing the right thing by speeding up our activites on this public website to our own custom needs. The way the website is designed and exposes all the HTML objects which we can control through VBA, it looks like if you know the train number and the travelling class, you can jump through until the seat selection(if available on the website) with a click of a button on Excel.
Sub Fill_Website_Textbox()
Dim objIE As SHDocVw.InternetExplorer
Dim OrgBox, orgbox1, orgbox2, orgbox3, orgbox4, orgbutton5, elementCol As HTMLInputElement
Set objIE = New SHDocVw.InternetExplorer
objIE.navigate "
https://www.irctc.co.in/"
objIE.Visible = True
Do While objIE.readyState < 4: Loop
Set OrgBox = objIE.Document.getElementById("username")
Set orgbox1 = objIE.Document.getElementById("password")
Set orgbox2 = objIE.Document.getElementById("button")
OrgBox.Value = "----------" 'What ever is the user Id
orgbox1.Value = "--------" 'What ever is the password
orgbox2.Click
'Do Until Not objIE.Busy and 'And objIE.readyState = 3
'
'DoEvents
'Loop
Do
Set orgbox3 = objIE.Document.getElementById("stationFrom")
Set orgbox4 = objIE.Document.getElementById("stationTo")
Set orgbutton5 = objIE.Document.getElementById("Submit")
DoEvents
Loop While orgbox3 Is Nothing Or orgbox4 Is Nothing Or orgbutton5 Is Nothing Or objIE.Busy
'elementCol.Value = "CSTM"
objIE.Visible = True
orgbox3.Value = "CSTM"
orgbox4.Value = "HYB"
orgbutton5.Click
End Sub