Help with VBA to select and dowload report in Internet Explorer

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:

9XCtn2y5Y.png


And html for Retrieve button:
9XDuDysDR.png


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

9XExMvrbt.png


and HTML for file name:


9XFZnE4x8.png
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,011
Messages
6,122,680
Members
449,091
Latest member
peppernaut

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