0

I have a website that hosts reports. I can download the report as a file if I click a java script encoded button. I'd like to use VBA to download the file programmatically but have no idea if it's even possible let alone where to start looking.

I hear you can embed java script into HTML. Would it be possible to call the website using a customized URL that incorporates the websites java script?

I also thought about downloading the page and crafting it so that when it's called locally as a file it will automatically run the javascript and prompt the download from the external server.

The URL is

https://my.workflowmax.com/reports/view.aspx?id=12345

The button in question has this: I have no idea what it means.

javascript:__doPostBack('ctl00$PageContent$btn1_Option1','')

Here is the full html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html class=" ext-strict" xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>
    WorkflowMax | Inventory Report
</title>
    <link type="text/css" rel="stylesheet" href="WorkflowMax%20_%20Inventory%20Report_files/ext-all.css"><link type="text/css" rel="Stylesheet" href="WorkflowMax%20_%20Inventory%20Report_files/HttpCombiner-v3_2_3_148.css"><link type="text/css" rel="stylesheet" href="WorkflowMax%20_%20Inventory%20Report_files/blue.css"><!--[if IE 7]><link rel="stylesheet" type="text/css" href="../css/IE7.css" /><![endif]--><link rel="stylesheet" type="text/css" href="WorkflowMax%20_%20Inventory%20Report_files/print.css" media="print"></head>
<body class="maxbody  ext-gecko ext-gecko3">

<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/jquery.js"></script>
<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/workflowmax.js"></script>


<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/prototype.js"></script>
<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/20100518-lib.js"></script>

<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/ext-prototype-adapter.js"></script>
<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/ext-all.js"></script>

<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/HttpCombiner-v3_2_3_148.js"></script>


    <form name="aspnetForm" method="post" action="view.aspx?id=1549031" id="aspnetForm" autocomplete="off">
<div>
<input name="__EVENTTARGET" id="__EVENTTARGET" value="" type="hidden">
<input name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" type="hidden">
<input name="__VIEWSTATE_GUID" id="__VIEWSTATE_GUID" value="3ff79129-c11a-4377-9585-dc9af902c872" type="hidden">
<input name="__VIEWSTATE" id="
__VIEWSTATE" value="" type="hidden">
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>



<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/WorkFlowMax_003.js"></script>
<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/WorkFlowMax.js"></script>
<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/WorkFlowMax_002.js"></script>
<script text/javascript:__doPostBack('ctl00$PageContent$btn1_Option1','')""></script>


        <div class="module-report pagetype-reportview">
            <div class="wrapper">
                <div class="MaxBanner">

                    <div class="userlabel">John Doe | ExampleCompany</div>

                    <div id="ext-gen3" class="search">
                        <div style="width: 319px;" id="ext-gen4" class="x-form-field-wrap x-form-field-trigger-wrap"><input style="width: 318px;" autocomplete="off" name="search_field" id="search_field" class="SearchTextBox x-form-text x-form-field" type="text"><img style="display: none;" id="ext-gen5" src="WorkflowMax%20_%20Inventory%20Report_files/s.gif" class="x-form-trigger x-form-arrow-trigger"></div> 
                            <a href="javascript:GoSearch();" id="btnSearch" class="SearchButton2">
                                <span>GO</span>
                        </a>
                    </div>    

                </div>
<!--                
                <div class="spacer">
                </div>
-->                

                <div class="menu2">
                    <ul class="menu-nav" id="nav-left"><li class="menu-spacer " style="width:20px; z-index: 1;"></li><li id="my-menu-c2" class="top" style="z-index:1;"><a href="https://my.workflowmax.com/my/overview.aspx">My Max</a><div class="callout" id="my-menu-c2"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/my/overview.aspx">Overview</a></li><li><a href="https://my.workflowmax.com/my/timesheet.aspx?filter=">Time Sheet</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/my/preferences.aspx">Preferences</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/portal/default.aspx">Portal</a></li></ul></div><div class="menu-column2"><h1>Enter Time</h1><ul><li><a href="https://my.workflowmax.com/my/timesheet.aspx?filter=">Daily</a></li><li><a href="https://my.workflowmax.com/my/timesheet.aspx?filter=&amp;tab=weekly">Weekly</a></li></ul></div></div></li><li class="top" style="z-index:1;"><a href="https://my.workflowmax.com/client/clientlist.aspx">Clients</a><div class="callout"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/client/clientlist.aspx">Client Manager</a></li><li><a href="https://my.workflowmax.com/client/clientedit.aspx">New Client</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/client/contactlist.aspx">Contact Manager</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/client/supplierlist.aspx">Supplier Manager</a></li></ul></div></div></li><li class="top" style="z-index:1;"><a href="https://my.workflowmax.com/job/joblist.aspx">Jobs</a><div class="callout"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/job/joblist.aspx">Job Manager</a></li><li><a href="https://my.workflowmax.com/job/jobedit.aspx">New Job</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/job/tasklist.aspx">Task Manager</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/job/collaboration.aspx">Collaboration Manager</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/job/jobschedule.aspx">Job Schedule</a></li><li><a href="https://my.workflowmax.com/job/resourceschedule.aspx">Staff Schedule</a></li></ul></div></div></li><li class="top" style="z-index:1;"><a href="#">Financial</a><div class="callout"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/financial/quotelist.aspx">Quote Manager</a></li><li><a href="https://my.workflowmax.com/financial/quoteedit.aspx?type=2">New Estimate</a></li><li><a href="https://my.workflowmax.com/financial/quoteedit.aspx?type=1">New Quote</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/financial/invoicelist.aspx">Invoice Manager</a></li><li><a href="https://my.workflowmax.com/common/option.aspx?id=0&amp;pagetype=131">New Progress Invoice</a></li><li><a href="https://my.workflowmax.com/common/option.aspx?id=0&amp;pagetype=130">New Invoice</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/financial/purchaseorderlist.aspx">Purchase Order Manager</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/financial/timesheet.aspx">Time Sheets</a></li></ul></div></div></li><li id="report-menu" class="top selected" style="z-index:1;"><a href="#">Reports</a><div class="callout" id="report-menu"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/common/option.aspx?id=0&amp;pagetype=139">Financial Reports</a></li><li><a href="https://my.workflowmax.com/reports/my.aspx">My Reports</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/reports/builder.aspx">Report Builder</a></li></ul></div><div class="menu-column2"><h1>Favourites</h1><ul><li><span>There are no favourite reports selected.</span></li></ul></div></div></li><li id="admin-menu-c2" class="top" style="z-index:1;"><a href="#">Admin</a><div class="callout" id="admin-menu-c2"><div class="menu-column1"><ul><li><a href="https://my.workflowmax.com/admin/clienttypelist.aspx">Client Type</a></li><li><a href="https://my.workflowmax.com/admin/costlist.aspx">Cost</a></li><li><a href="https://my.workflowmax.com/admin/customfieldlist.aspx">Custom Fields</a></li><li><a href="https://my.workflowmax.com/admin/customtemplatelist.aspx">Custom Templates</a></li><li><a href="https://my.workflowmax.com/admin/documentmanagement.aspx">Document Management</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/admin/jobtypelist.aspx">Job Category</a></li><li><a href="https://my.workflowmax.com/admin/jobstatelist.aspx">Job State</a></li><li><a href="https://my.workflowmax.com/admin/jobtemplatelist.aspx">Job Template</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/admin/notification.aspx">Notification</a></li><li><a href="https://my.workflowmax.com/admin/personalise.aspx">Personalise</a></li><li><a href="https://my.workflowmax.com/admin/preferences.aspx">Preferences</a></li><li><a href="https://my.workflowmax.com/admin/resourcelist.aspx">Staff</a></li><li><a href="https://my.workflowmax.com/admin/tasklist.aspx">Task</a></li></ul></div><div class="menu-column2"><h1>Interfaces</h1><ul><li><a href="https://my.workflowmax.com/admin/connectors.aspx">Connectors</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/admin/ipayroll.aspx">iPayroll</a></li><li><a href="https://my.workflowmax.com/admin/kashflow.aspx">KashFlow</a></li><li><a href="https://my.workflowmax.com/admin/saasu.aspx">Saasu</a></li><li><a href="https://my.workflowmax.com/admin/xero2.aspx">Xero</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/common/option.aspx?id=0&amp;pagetype=149">Export</a></li><li><a href="https://my.workflowmax.com/common/option.aspx?id=0&amp;pagetype=150">Import</a></li></ul></div></div></li><li class="menu-spacer-left " style="width:20px; z-index: 1;"></li></ul><ul class="menu-nav" id="nav-right"><li class="menu-spacer right" style="width:20px; z-index: 1;"></li><li id="menu-timeclock" class="top timeclock" style="z-index:1;"><a href="#" onclick="WorkflowMax.UI.TimerManager.toggle();"> </a></li><div id="timer-dropdown" class="hidden"></div><li class="top" style="z-index:1;"><a href="#">Help</a><div class="callout"><div class="menu-column1"><ul><li><a href="http://support.workflowmax.com/home" target="_blank">Need Help?</a></li><li><a href="http://support.workflowmax.com/categories/10336" target="_blank">Video Tutorials</a></li><li><a href="http://events.workflowmax.com/upcoming-courses/locations/online" target="_blank">Webinars and Training</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/max/contact.aspx">Contact Support</a></li><li><a href="javascript:WorkflowMax.UI.Support.invite();">Invite Support?</a></li><li class="menu-break"><div class="menu-break"> </div></li><li><a href="https://my.workflowmax.com/admin/subscription.aspx">My Subscription</a></li></ul></div></div></li><li class="top" style="z-index:1;"><a href="https://my.workflowmax.com/logout.aspx">Logout</a></li></ul>
                </div>

                <div class="MaxPageInfo">
                    <div class="pageinfopath"><a href="https://my.workflowmax.com/reports/my.aspx">My Reports</a><span>›</span><span>&nbsp;</span></div><span class="pageinfotitle">Inventory Report</span>
                </div>

                <div class="spacer2">
                </div>
                <table border="0" cellpadding="0" cellspacing="0">
                    <tbody><tr>

                        <td style="width: 970px;" valign="top">

                            <div class="pagecontent">


    <div style="padding: 5px;">
        <div id="ctl00_PageContent_LayoutValidationSummary" class="message alert" style="color:Red;display:none;">

</div><div id="ctl00_PageContent_LayoutValidationSummarySubLayout" class="message alert" style="color:Red;display:none;">

</div>        


            <div class="report-criteria-explanation">
                Quantity returned to Inventory greater than 0, and<br>Inventory returned date is on or after the start of last month, and<br>Inventory returned date is on or before the end of last month
            </div>                                                    


        <table border="0" cellpadding="0" cellspacing="0" width="100%">
            <tbody><tr>
                <td>
                    <div class="ButtonPanel left"><span class="button-option"><input name="ctl00$PageContent$btn1" value="Export" onclick="return false;" id="ctl00_PageContent_btn1" type="submit"><a class="dropdown" onclick="return clickreturnvalue();" onmouseover="dropdownmenu(this, event, 'ctl00_PageContent_btn1_Options', -100)"><span> </span></a><div style="visibility: hidden; left: 10px; top: 280px;" id="ctl00_PageContent_btn1_Options" class="anylinkcss"><div><a onclick="return exporter.generate('csv');" id="ctl00_PageContent_btn1_Option1" href="javascript:__doPostBack('ctl00$PageContent$btn1_Option1','')">CSV</a></div><div><a onclick="return exporter.generate('xml');" id="ctl00_PageContent_btn1_Option2" href="javascript:__doPostBack('ctl00$PageContent$btn1_Option2','')">XML</a></div></div></span><span>&nbsp;</span><input name="ctl00$PageContent$btn2" value="Print" onclick="window.print(); return false;" id="ctl00_PageContent_btn2" class="button" type="submit"></div>
                </td>
                <td align="right">
                    <div class="ButtonPanel"><input name="ctl00$PageContent$btnShowCriteria" value="Show Criteria" onclick="return showCriteria('ctl00_PageContent_btnShowCriteria');" id="ctl00_PageContent_btnShowCriteria" class="wide-button" type="submit"></div>
                </td>
            </tr>
        </tbody></table>

        <div id="report-criteria-container" class="no-print" style="display: none; ">
            <table class="report-designer step3" border="0" cellpadding="0" cellspacing="0" width="100%">
    <tbody><tr>
        <td class="report-content"><div id="ctl00_PageContent_ctl06" class="report-criteria"></div></td>
    </tr>
</tbody></table>
<div class="ButtonPanel"><input name="ctl00$PageContent$btn0" value="Refresh" onclick="return designer.refreshView();" id="ctl00_PageContent_btn0" class="button" type="submit"></div>
        </div>

        <div class="spacer">

</div><table class="HtmlGrid" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr class="HtmlGridHeadingRow"><td class="HtmlGridHeadingCell">Job No.</td><td class="HtmlGridHeadingCell">Description</td><td class="HtmlGridHeadingCell">Project Manager</td><td class="HtmlGridHeadingCell">Date</td><td class="HtmlGridHeadingCell">Supplier</td><td class="HtmlGridHeadingCell">Name</td><td class="HtmlGridHeadingCell">Description</td><td class="HtmlGridHeadingCell">Code</td><td class="HtmlGridHeadingCell" align="right">Cost</td><td class="HtmlGridHeadingCell" align="right">Quantity</td><td class="HtmlGridHeadingCell" align="right">Quantity returned to Inventory</td><td class="HtmlGridHeadingCell">Inventory returned date</td></tr><tr><td class="HtmlGridCell"><a class="link" href="https://my.workflowmax.com/job/jobview.aspx?id=1234567">J000123</a></td><td class="HtmlGridCell">
<br>engineering work &amp; ACME 4 &amp; 7.</td><td class="HtmlGridCell">John Doe</td><td class="HtmlGridCell">18-Dec-2013</td><td class="HtmlGridCell"><a class="link" href="https://my.workflowmax.com/client/supplierview.aspx?id=12345">Engineering Products </a></td><td class="HtmlGridCell">Upgrade</td><td class="HtmlGridCell">INSTRUMENT</td><td class="HtmlGridCell"> </td><td class="HtmlGridCell" align="right">124.00</td><td class="HtmlGridCell" align="right">1.00</td><td class="HtmlGridCell" align="right">1</td><td class="HtmlGridCell">29-Jan-2014</td></tr><tr><td class="HtmlGridCell"><a class="link" href="https://my.workflowmax.com/job/jobview.aspx?id=1234567">J000123</a></td><td class="HtmlGridCell">supply new outlet to silo 1-5 &amp; ACME 4 &amp; 7.</td><td class="HtmlGridCell">John Doe2</td><td class="HtmlGridCell">23-Jan-2014</td><td class="HtmlGridCell"><a class="link" href="https://my.workflowmax.com/client/supplierview.aspx?id=44609"></a></td><td class="HtmlGridCell">Upgrade</td><td class="HtmlGridCell">1" Automatic Butterfly</td><td class="HtmlGridCell"> </td><td class="HtmlGridCell" align="right">856.42</td><td class="HtmlGridCell" align="right">1.00</td><td class="HtmlGridCell" align="right">1</td><td class="HtmlGridCell">28-Jan-2014</td></tr><tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td class="FinancialGridTotalCell">980.42</td><td> </td><td class="FinancialGridTotalCell">2</td><td> </td></tr></tbody></table>
    </div>



<script type="text/javascript">    

    var exporter = new WorkflowMax.Control.ReportExport(31321321);


    var designer = new WorkflowMax.Control.ReportDesigner(16323432);    


    function showCriteria(button)
    {        
        if (Element.visible('report-criteria-container'))
        {
            Element.hide('report-criteria-container');
            $(button).value = "Show Criteria";
        }
        else
        {
            Element.show('report-criteria-container');
            designer.loadEditableCriteria('ctl00_PageContent_ctl06');    
            $(button).value = "Hide Criteria";
        }
        return false;
    }


</script>


                            </div>
                        </td>                        
                    </tr>
                </tbody></table>
                <div class="spacer">
                </div>

                <div id="footer">
                    <a href="https://my.workflowmax.com/legal/legalstuff.aspx">Terms &amp; Conditions</a>                
                </div> 

                <div id="auto_complete" class="autocomplete" style="z-index: 999; display: none;"></div>               
            </div>
        </div>

<script type="text/javascript">
//<![CDATA[
var Page_ValidationSummaries =  new Array(document.getElementById("ctl00_PageContent_LayoutValidationSummary"), document.getElementById("ctl00_PageContent_LayoutValidationSummarySubLayout"));
//]]>
</script>

<script type="text/javascript">
//<![CDATA[
var ctl00_PageContent_LayoutValidationSummary = document.all ? document.all["ctl00_PageContent_LayoutValidationSummary"] : document.getElementById("ctl00_PageContent_LayoutValidationSummary");
ctl00_PageContent_LayoutValidationSummary.displaymode = "List";
var ctl00_PageContent_LayoutValidationSummarySubLayout = document.all ? document.all["ctl00_PageContent_LayoutValidationSummarySubLayout"] : document.getElementById("ctl00_PageContent_LayoutValidationSummarySubLayout");
ctl00_PageContent_LayoutValidationSummarySubLayout.displaymode = "List";
ctl00_PageContent_LayoutValidationSummarySubLayout.validationGroup = "SubLayout";
//]]>
</script>

<div>

    <input name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBwL+raDdrdtpAgsCgLQjP/EDgLQjIPFDgKZoKWsCgjhgjhgKmuseGAwKZoJ2sCuT5ooWx0znUqVcCNab" type="hidden"
</div>

<script type="text/javascript">
//<![CDATA[
WorkflowMax.Tooltip.init();//]]>
</script>
</form>    

<script type="text/javascript" src="WorkflowMax%20_%20Inventory%20Report_files/workflowmax_002.js"></script>



</body></html>
3
  • Not enough detail to suggest options - really depends on exactly how the reports are downloaded. Commented Feb 26, 2014 at 6:58
  • What sort of details do you need? Commented Feb 26, 2014 at 8:34
  • A URL or all of the relevant page source HTML. Commented Feb 26, 2014 at 17:16

1 Answer 1

1

Try this to fire a click event:

IE.document.getElementById("ctl00$PageContent$btn1_Option1").click()
IE.document.getElementById("ctl00$PageContent$btn1_Option1").FireEvent("onclick")
Sign up to request clarification or add additional context in comments.

2 Comments

Do it insert this into the html?
No, It will just click on the button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.