henryshen
12-04-2014, 05:09 PM
hi, im a noobie on vba programming. i hv copy and pasted some codes from somewhere else of navigating an url and submiting a form to enter userID and password. but i got stucked when i was going to use vba codes to download a report generated by the website, which means there is no static url to the file that i need to download. What I want to do is write a code of trying to click some buttons on the page as i click to download something physically on IE. much appreciated in advance, anybody can help me?
12585
As is shown, what i normally do is click on that image of a soft disk, and then there appears a dropdown list. then click on “excel” to download an excel spreadsheet.
the html code of that soft disk and excel option is as below:
<table id="reportViewer_ctl05_ctl04_ctl00_Button" title="Export"><tr><td><a id="reportViewer_ctl05_ctl04_ctl00_ButtonLink" title="Export" alt="Export" href="javascript:void(0)" style="text-decoration:none;"><img id="reportViewer_ctl05_ctl04_ctl00_ButtonImg" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=11.0.3366.16&Na me=Microsoft.Reporting.WebForms.Icons.ExportDisabled.gif" alt="Export" style="border-style:None;height:16px;width:16px;" /><span style="width:5px;text-decoration:none;"> </span><img id="reportViewer_ctl05_ctl04_ctl00_ButtonImgDown" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=11.0.3366.16&Na me=Microsoft.Reporting.WebForms.Icons.ArrowDownDisabled.gif" alt="Export" style="border-style:None;height:6px;width:7px;margin-bottom:5px;" /></a></td></tr></table>
....
<div style="border:1px transparent Solid;">
<a title="Excel" alt="Excel" onclick="$find('reportViewer').exportReport('EXCELOPENXML');" href="javascript:void(0)" style="color:#3366CC;font-family:Segoe UI,Tahoma,Arial;font-size:11px;padding:3px 8px 3px 8px;display:block;white-space:nowrap;text-decoration:none;">Excel</a></div>
12585
As is shown, what i normally do is click on that image of a soft disk, and then there appears a dropdown list. then click on “excel” to download an excel spreadsheet.
the html code of that soft disk and excel option is as below:
<table id="reportViewer_ctl05_ctl04_ctl00_Button" title="Export"><tr><td><a id="reportViewer_ctl05_ctl04_ctl00_ButtonLink" title="Export" alt="Export" href="javascript:void(0)" style="text-decoration:none;"><img id="reportViewer_ctl05_ctl04_ctl00_ButtonImg" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=11.0.3366.16&Na me=Microsoft.Reporting.WebForms.Icons.ExportDisabled.gif" alt="Export" style="border-style:None;height:16px;width:16px;" /><span style="width:5px;text-decoration:none;"> </span><img id="reportViewer_ctl05_ctl04_ctl00_ButtonImgDown" src="/Reserved.ReportViewerWebControl.axd?OpType=Resource&Version=11.0.3366.16&Na me=Microsoft.Reporting.WebForms.Icons.ArrowDownDisabled.gif" alt="Export" style="border-style:None;height:6px;width:7px;margin-bottom:5px;" /></a></td></tr></table>
....
<div style="border:1px transparent Solid;">
<a title="Excel" alt="Excel" onclick="$find('reportViewer').exportReport('EXCELOPENXML');" href="javascript:void(0)" style="color:#3366CC;font-family:Segoe UI,Tahoma,Arial;font-size:11px;padding:3px 8px 3px 8px;display:block;white-space:nowrap;text-decoration:none;">Excel</a></div>