Private Sub CommandButton1_Click()
' Prepare to open the web page
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.Navigate "http://218.248.72.237/BSNL/"
' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop
'Login to the website
Set ipf = ie.document.all.Item("txtUserName")
ipf.Value = Trim(ActiveSheet.Range("H4").Value)
Set ipf = ie.document.all.Item("txtUserPass")
ipf.Value = ActiveSheet.Range("H5").Value
Set ipf = ie.document.all.Item("Submit")
ipf.Value = "Enter"
ipf.Click
' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop
' Downloading the file
.Navigate "http://218.248.72.237/BSNL/OPERATOR/home/LKLexportExcel.asp?mode=excel"
' Close the internet explorer application
ie.Quit
end with
End Sub
Bookmarks