Consulting

Results 1 to 5 of 5

Thread: click a button in a dropdown menu on webpage to download sth using vba

  1. #1

    Red face click a button in a dropdown menu on webpage to download sth using vba

    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?
    excel2.jpg
    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:
    HTML Code:
    <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&amp;Version=11.0.3366.16&amp;Name=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&amp;Version=11.0.3366.16&amp;Name=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>

  2. #2
    what i was trying to do is like:
    With ie
    Set dmt1 = .document
    dmt1.getelementbyid("reportViewer_ctl05_ctl04_ctl00_ButtonImg").Click
    End With
    since that "excel" option label does not have an ID or name, i cannot capture it.

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    The only part of the code that you show that is of use to you is
    onclick="$find('reportViewer').exportReport('EXCELOPENXML');" href="javascript:void(0)"
    and even that is only a piece of what you need.

    Save the page as Web Page Complete (? Not sure about IE's Save) and look in the _Files folder for a js with "ReportViewer" in it.
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    hi, Sam, i would like to thank you for your reply firsr. i just went through all js from the _files folder and found only one js with "reportviewer" in it which i attached it. i dont think it is of use.
    ["Error_Title_0x80048313"]='Reporting Error';errorTable["Error_Message_0x80048313"]='The SOAP endpoint used by the ReportViewer control could not be accessed.
    actually what i really want to do is get the generated excel file from report template in the CRM portal and then copy and paste raw data into the worksheet that contains lots of macro to do the analysis. i hope to make the process as simple as possible better by just one click. now i can easily get into the report template by one click but i cannot trigger the save as or open window to open that excel file which i believe is already there on the server if you know what i mean. since the CRM portal is not like the other webpages. it hides lots of html codes. so far, i've almost given up keeping trying this, but thank you anyway.

  5. #5
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location


    Good luck
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •