VBA Download Excel Repoort From an ASP Site

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
Once upon a time our Maintenance department used a software package that sat on top of an Oracle Database within our network to manage all planned and unplanned Maintenance activities. A decade ago I built various automated reports from the background tables and created tools to allow the production schedulers to plan around machine downtimes.

Fast forward to Cloud Computing. Data is now housed somewhere outside of our network. The only access I seem to have is to use IE to log into the Maintenance Vendors site and fill in the various fields on the search page to return a report of all open requests. The results get returned in the Explorer Window, with an option to export results to Excel. No Problem. A Simple IE Automation gets me to this point. I can even use the .Click method of the Excel Link Object to start the download process automatically. Where I get Stymied is that a sweep of all Windows using Windows API's does not expose the Open, Save, Cancel buttons in the standard IE Popup that asks what do you want to do with this file. I can't get the HWND of these buttons to press them with code. The .href property of the link is some ASP routine, so the URLDownlad API does not work.

Please help...
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You cannot reliably use IE for this. You need to send the actual request that IE sends directly using something like WINHTTP, this will return the file as a stream that you can write to disk. You can use the developer tools in IE (though Chrome/Firefox would be better) to see the actual request you need to send.
 
Upvote 0
WinHTTP Looks like a steep learning curve with a library download. Not sure that IT Security will allow me as a lowly peon to actually implement this. Found a hack using the UIAutomationCore.dl library that seems like it will fit the bill.
 
Upvote 0
Not sure what you mean by a library download, it's already on your computer and it's probably less code than automating ie. Glad you got it sorted though :)
 
Upvote 0
I'm always interested in having more than one tool in my box to get a job done. But I did not see a WinHTTP library (or any obvious variation) in the References dialog of the VBE. So I guess I'll ask the VBA 101 question of "Which reference do I need to add to include this library in my project?"
 
Upvote 0
Upvote 0
Cool. Enough to get started with. Thank you sir for an alternative path. I'm sure this will come in handy, If not on this project, then on some future project.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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