+ Reply to Thread
Results 1 to 5 of 5

How to Pause Script While Internet Explorer Downloads File

  1. #1
    Registered User
    Join Date
    10-14-2015
    Location
    East Coast
    MS-Off Ver
    2013
    Posts
    69

    How to Pause Script While Internet Explorer Downloads File

    All,

    I'm having some difficulty with the following. I have a script that will automate internet explorer to download a csv from a website (by clicking an "export" button on the IE webpage). I need to be able to pause my code until the yellow "Open/Save" bar at the bottom of the page appears.

    Any ideas here?

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to Pause Script While Internet Explorer Downloads File


    See VBA Wait method or Sleep from a Windows dll or via UIAutomationClient or …

    But better than piloting IE is to directly use a web request (the same use by webbrowsers) when possible.

  3. #3
    Registered User
    Join Date
    10-14-2015
    Location
    East Coast
    MS-Off Ver
    2013
    Posts
    69

    Re: How to Pause Script While Internet Explorer Downloads File

    Hi Marc,

    The workbook in question is planned to be sent out to ~30 end-users (Excel 2013 and up, 32 & 64 bit machines). Do you think integrating windows dll or UIAutomationClient would result in errors? Admittedly, i'm not as experienced in this realm of vba. I'd like to learn more about the direct web requests via vba as well.

    To this point, i've been unable to pin down the URL of the download too...it's simply a button on a web-page. I wish I could shoot over the page, but there are privacy issues..

    As a work around i've been using ie.busy functions followed by the VBA wait method. Then sendkeying ctrl+j to the IE window to download the file to the machine...clunky I know..

    Any guidance that you could offer would be really appreciated!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: How to Pause Script While Internet Explorer Downloads File

    Hi Chris,

    You might need to use "DoEvents" in your code to let other apps finish before coming back to Excel VBA.

    https://msdn.microsoft.com/en-us/vba...vents-function
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: How to Pause Script While Internet Explorer Downloads File

    Quote Originally Posted by ChrisHook View Post
    The workbook in question is planned to be sent out to ~30 end-users (Excel 2013 and up, 32 & 64 bit machines). Do you think integrating windows dll or UIAutomationClient would result in errors?
    Could be as I already saw a working code piloting IE on some computers but failing on another (nothing to do with 64 bit)
    as it may depend on IE & Windows version …
    Guidance is difficult as piloting IE is specific to each webpage, as we can't guess …
    So first try with Wait method and search on web VBA samples.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pause script until file generated
    By plans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2016, 04:01 PM
  2. Automating Save/Downloads from Internet Explorer
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-25-2015, 07:35 PM
  3. Internet Explorer not validating dropdown list commands given by VBA script
    By siddharth1980 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-03-2013, 04:16 PM
  4. Automation of Java Script links in Internet Explorer using VBA
    By jagguvaka in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-29-2013, 12:00 PM
  5. internet file downloads
    By vipul.halbe in forum Excel General
    Replies: 3
    Last Post: 07-04-2011, 11:02 AM
  6. CVS file in Internet Explorer
    By Nik in forum Excel General
    Replies: 0
    Last Post: 12-22-2005, 06:20 AM
  7. error in script from internet explorer
    By fred6529 in forum Excel General
    Replies: 0
    Last Post: 06-11-2005, 04:05 PM

Tags for this Thread

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