JrExcelTor
New Member
- Joined
- May 30, 2015
- Messages
- 15
Hi Gang!
I have weekly reports I run which requires a manual login and pull every time. It is very tedious. I have written code so far that launches IE, and signs me into website navigating to reports page. Where I am stuck - need to select a box based on report name, than click a retrieve button (ref pic below). When this happens, a pop window appears asking to download or open file - I would like to Download it TO DESKTOP. I have added html code for the check box and retrieve button.
My code thus far: Pics of HTML code to follow:
ANY HELP IS APPRECIATED.
THANK YOU!!!
Sub test()
' open IE, navigate to the desired page and loop until fully loaded
Set ie = CreateObject("InternetExplorer.Application")
my_url = "https://MYWEBSITE"
With ie
.Visible = True
.Navigate my_url
Do Until Not ie.busy And ie.readystate = 4
DoEvents
Loop
End With
While ie.busy
DoEvents
Wend
' Input the userid and password
ie.document.getelementbyid("txtUser").Value = "ID"
ie.document.getelementbyid("txtPass").Value = "PASSWORD"
' Click the "Search" button
ie.document.getelementbyid("Login").Click
While ie.busy
DoEvents
Wend
With ie
Do While .busy Or .readystate <> 4
DoEvents
Loop
End With
While ie.busy
DoEvents
Wend
Set objInputs = ie.document.getElementsByTagName("a")
For Each ele In objInputs
If ele.Title Like "Report Status Page" Then
ele.Click
End If
Next
ADD MISSING CODE HERE
'MsgBox "Done"
End Sub
Here is html code of Check box:
And html for Retrieve button:
Link of Toolbar - File to be downloaded is weekly report raw data spreads
and HTML for file name:
I have weekly reports I run which requires a manual login and pull every time. It is very tedious. I have written code so far that launches IE, and signs me into website navigating to reports page. Where I am stuck - need to select a box based on report name, than click a retrieve button (ref pic below). When this happens, a pop window appears asking to download or open file - I would like to Download it TO DESKTOP. I have added html code for the check box and retrieve button.
My code thus far: Pics of HTML code to follow:
ANY HELP IS APPRECIATED.
THANK YOU!!!
Sub test()
' open IE, navigate to the desired page and loop until fully loaded
Set ie = CreateObject("InternetExplorer.Application")
my_url = "https://MYWEBSITE"
With ie
.Visible = True
.Navigate my_url
Do Until Not ie.busy And ie.readystate = 4
DoEvents
Loop
End With
While ie.busy
DoEvents
Wend
' Input the userid and password
ie.document.getelementbyid("txtUser").Value = "ID"
ie.document.getelementbyid("txtPass").Value = "PASSWORD"
' Click the "Search" button
ie.document.getelementbyid("Login").Click
While ie.busy
DoEvents
Wend
With ie
Do While .busy Or .readystate <> 4
DoEvents
Loop
End With
While ie.busy
DoEvents
Wend
Set objInputs = ie.document.getElementsByTagName("a")
For Each ele In objInputs
If ele.Title Like "Report Status Page" Then
ele.Click
End If
Next
ADD MISSING CODE HERE
'MsgBox "Done"
End Sub
Here is html code of Check box:

And html for Retrieve button:

Link of Toolbar - File to be downloaded is weekly report raw data spreads

and HTML for file name:
