+ Reply to Thread
Results 1 to 9 of 9

Control Internet Explorer "File Download Pop Up Box"

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Control Internet Explorer "File Download Pop Up Box"

    Hi,
    I have a new project I was hoping someone could advise how to handle a couple issues.


    The script below will do all of the following

    Navigate to a webpage
    Click a Javascript link relateing to a built in calendar on the webpage.
    Click 2 Radio Buttons
    Then Click a summit button

    My first issue is how to make my code wait long enough for the next button to appear?

    Currently I'm using the wait for 50 seconds but the time will always change depending on how much data is being collected. So is there a way for my code to know when the button shows up on the webpage?

    Next Issue is After the button appears and is clicked a "File Download Pop Up Box" appears with options Open,Save and Cancel

    How can I click the save button to save the file on a folder on my desktop?

    Thanks for the help as always, Mike

    Here is my code:
    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Control Internet Explorer "File Download Pop Up Box"

    Hello realniceguy5000,

    Here is a loop to test the buttons existence.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Control Internet Explorer "File Download Pop Up Box"

    Thank You Leith, That snip it of code works great. Let me know if you have anything on the other issue I am having.

    Thanks Again, Mike

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Control Internet Explorer "File Download Pop Up Box"

    Hello Mike,

    I am assuming this dialog message is from Windows. What causes the dialog to pop up? Does a "Save" button get clicked by the code or user?

  5. #5
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Control Internet Explorer "File Download Pop Up Box"

    Hi Leith,

    Here is what happends After the code you gave me to wait on the "ctl00$MainContent$Button2" to appear.

    MainContent$Button2 = Export to Excel
    This button is used to export the data to excel it shows up after the data is ran on the web page.I used your code to wait till it appears to click it in VBA

    After the Export button is clicked A File Download Dialog Box appears. Looks like a windows Type dialog box.

    I'm currently trying to use the Send Keys to hit the Save Button on this dialog. I'd like a better way as the send keys wont work consistently.

    After the send keys manage to hit the Save button Another box opens "Save A's" looks like a regular excel save as box.

    So what I'm looking for is a way to hit the save button with out using send keys and save the file to a folder on my desktop.

    Thanks again for your help...

    Here again is the complete code.

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Control Internet Explorer "File Download Pop Up Box"

    Hello Mike,

    If you want to save the file and the default button on the dialog is "Save" or "Save As" then you can try using Application.DisplayAlerts. This will automatically select the default dialog button and prevent it from showing. Not really sure were these statements should be placed in your code. You could place the first statement at the beginning and the second on at the end before exiting.
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Control Internet Explorer "File Download Pop Up Box"

    Yes, I tried the "Application.DisplayAlerts = False" Near the top of my code.However the file download dialog box still opens. Since the deafult on that window is cancel I use the send keys which seems to be working at this time.Once the send keys part of the script completed. That is when the Save A's dialog window appears.

    Now the Save A's window deafut position is the file name, the name of the file is already in place.

    then if I were to Tab again

    I would goto the Save As Type: Where Microsoft Excel Worksheet is already picked

    Then Tab Again Would take me to the Save Button.

    So let me ask, if I use send keys to tab around this (save as open window) what commads would I use to change the Save in: I would have to send Tab 2 more times to get to where the (save in: ) is located in the window. But if I could change where the file goes then tab a few more time and hit save this might work?

    Again Thank You, Mike

  8. #8
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Control Internet Explorer "File Download Pop Up Box"


  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Control Internet Explorer "File Download Pop Up Box"

    Instead of imitating a userinterface I would advice you to make use of VBA in Microsoft XML v3.0 library.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1