Closed Thread
Results 1 to 11 of 11

Downloading multiple files from Internet

  1. #1
    abhay_547
    Guest

    Downloading multiple files from Internet

    Hi All,

    I got the below code, from this site which downloads only one file at one go. I want the macro which will download multiple files from a list of links reflecting in a list box. I have created a userform which has a listbox which gets populated with all download links from where I want to download files. I need the help to implement the below code into my attached download tool userform.

    Please Login or Register  to view this content.
    Thanks for your help in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Downloading multiple files from Internet

    Make this a Global variable by moving it above all the code, that is, outside the routine.

    Please Login or Register  to view this content.

    Remove this line:

    Please Login or Register  to view this content.

    Then, having populated your form and selected the files to be downloaded, loop through the list, putting each one in the URL variable and calling the DownloadFilefromWeb subroutine.

    Regards

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

    Re: Downloading multiple files from Internet

    Hello abhay_547,

    Thought I recognized that code. I changed the download macro to Function to allow the URL and destination folder to be passed into the download loop. CommandButton5 now loops through URL and will display an error message if not successful. Also, a check is made that the destination folder has been selected. CommandButton2 has been updated to remove entries. All these changes are in the attached workbook.

    Module1 - Amended Download Macro
    Please Login or Register  to view this content.

    frmdownload CommandButton2 and CommandButton5 Macro Code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    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!)

  4. #4
    abhay_547
    Guest

    Re: Downloading multiple files from Internet

    Hi Ross,

    Thanks a lot for your reply, I tried to download some files using the revised version of download tool which you had attached with your earlier post. However the same is not working I am not sure why it's not working because the links which i am using are valid links but still shows error for each link and doesn't download any thing. It loops through each link reflecting in the listbox and shows error for each link though the links are working links. Attached is the file with the working links. Please help..


    Thanks a lot for your help in advance.
    Attached Files Attached Files

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

    Re: Downloading multiple files from Internet

    Hello abhay_547,

    My apologies for not catching that problem. In the original test, I had added a new file name to the directory path. We will need to work out how to name the files. In the meantime, here is the updated macro for downloading a file from the web. There is an extra argument for the new file's name.
    Please Login or Register  to view this content.

  6. #6
    abhay_547
    Guest

    Re: Downloading multiple files from Internet

    Hi Ross,

    Thanks a lot for your reply, I had incorporated the code provided by you in your earlier post in my download tool macro but it is showing an compile error. Attached is my download tool macro file for your reference.

    Apart from this I have identified one more issue in my macro .i.e. when I try to remove a URL from the listbox by selecting the same and clicking on remove button it gets only removed from the listbox but not from the excel sheet. It should ideally remove the selected listbox item from excel sheet as well and should ask first before removing the item from the listbox .i.e. a confirmation from user with a prompt .i.e. "Are you sure you want to remove this item".

    I have got the below code from the extensive google search for deleting items from listbox (which will also delete the items from excel sheet but some how when I am trying to incorporate the below code in my macro it doesn't work. Please help.

    Please Login or Register  to view this content.
    Apart from this I want to rename the downloaded files as per the names present against each link in the column B.


    Thanks a lot for your help in advance.
    Attached Files Attached Files
    Last edited by abhay_547; 10-03-2010 at 07:54 AM.

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

    Re: Downloading multiple files from Internet

    Hello abhay_547,

    I changed the macro to use columns "B" and "C" for the new file name and file type. I also added a status bar on the download form. Have a look at the attached workbook and let me know how if any changes need to be made.
    Attached Files Attached Files

  8. #8
    abhay_547
    Guest

    Re: Downloading multiple files from Internet

    Hi Ross,

    Thanks a lot for your reply. It's really amazing, but can we also show the column B and C in the list box along with Links .i.e. Listbox getting populated with multiple columns.

    I got the below code from an extensive google search but I am not sure how to incorporate the same in my macro. I tried put in userform initialize event but it's not working, it throws error.

    Please Login or Register  to view this content.
    Apart from this every day there is a new file uploaded on the links (which relfect in listbox). Is there any way that we can identify and download only latest files. If not can we have separate column for the original filename (which will be later on saved with the name present in column B). If yes, then we can show the same column as well in the listbox as original filename. Then we will have total four columns reflecting in the listbox.

    And one more thing can we modify the code in such a way that it doesn't stop if there is an error in a link or it's unable to download the file. The macro should go ahead and download other files in such cases and atlast should show a report .i.e. which file it was not able to download or if it was able to download all the files succefully then it should show message that "All files got successfully downloaded"

    Attached is my macro file for your reference.

    Thanks a lot for your help in advance.
    Attached Files Attached Files
    Last edited by abhay_547; 10-04-2010 at 11:15 AM.

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

    Re: Downloading multiple files from Internet

    Hello abhay_547,

    The new file name and type now appear in the ListBox. The two are concatenated to occupy a single column. The download messages have been changed. If there are no errors, the message is "All Files Downloaded Successfully". Other wise the message is "Download Complete - error count - File Errors". Each error is logged on the "Error Log" worksheet. "Sheet1" has been changed to "URL List".

    As for this question...
    Is there any way that we can identify and download only latest files?
    Probably, but I need more information on how to find the files and how to determine when they were added to the website.
    Attached Files Attached Files

  10. #10
    abhay_547
    Guest

    Re: Downloading multiple files from Internet

    Hi Ross,

    Thanks a lot. It's working perfectly as far as downloading the latest file issue is concerned. I am trying to do some research from my end on the same and will let you know once I get something.

    But for the time being can you please help me with the below.

    The list of URLs which relfect in the listbox has some files which are zip files I want the macro to unzip the same and save it to the selected folder. I have below code which can unzip / uncompress the compressed files but I am not sure how to incorporate the same in the my existing macro. Please help..

    Please Login or Register  to view this content.

    Thanks a lot for your help in advance.
    Last edited by abhay_547; 10-13-2010 at 10:30 PM.

  11. #11
    abhay_547
    Guest

    Re: Downloading multiple files from Internet

    Hi All,

    Did anyone get the chance to look into the above post. ?

    Thanks a lot for your help in advance.

Closed 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