+ Reply to Thread
Results 1 to 5 of 5

Download CSV File from Website

  1. #1
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Download CSV File from Website

    Hi,

    I would like to download a csv file from internet through vba. Let me explain in detail, I have csv file website link in Excel(cell A1),
    What I need to do is when I run the macro code
    1. To copy the link in Cell A1 and search the default web browser in system
    2. Paste the link in url path and download and save to a specific folder in local drive without any dial box(open/save/save as etc.)
    3. When save as to local folder, replace the file if already exists in the same name


    Any help would be greatly appreciated.

    Thanks,
    Chinraj

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Download CSV File from Website

    It's not what you want but yu can arrange it
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Download CSV File from Website

    Hi, chinraj,

    Range A1 holds the information to the file as follows:

    http://pic.dhe.ibm.com/infocenter/ti...leteSample.csv

    Code is inserted in a standard module:
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Download CSV File from Website

    Quote Originally Posted by HaHoBe View Post

    Range A1 holds the information to the file as follows:

    http://pic.dhe.ibm.com/infocenter/ti...leteSample.csv

    Code is inserted in a standard module:
    Hi Ciao,
    Thank you very much for the reply. I have tried the above code with same steps, it works perfectly with your link in cell A1.
    But I put my own link(https://confidential/report.csv), it shows a Run-time error '1004' like below,
    'C:\Documents and Settings\Chinraj\My Documents\reports.csv' could not be found. Check the spelling the file name, and verify that the file location correct.
    If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, deleted.


    But I copy the link in cell A1 and put in my web browser url path by manually, then its working(downloading) the file. The above code is not supports to download the file from secured(https://) server, is it?

    PS: The same code has worked fine in my colleague's system for some time(NOT ALL THE TIMES). Sometime they are also getting the same error message.

    Hi Patel, thanks for the code. But the result seems like above error for some time.

    Regards,
    Chinraj

  5. #5
    Registered User
    Join Date
    02-27-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Download CSV File from Website

    Quote Originally Posted by HaHoBe View Post

    Range A1 holds the information to the file as follows:

    http://pic.dhe.ibm.com/infocenter/ti...leteSample.csv

    Code is inserted in a standard module:
    Hi Ciao,
    Thank you very much for the reply. I have tried the above code with same steps, it works perfectly with your link in cell A1.
    But I put my own link(https://confidential/report.csv), it shows a Run-time error '1004' like below,
    'C:\Documents and Settings\Chinraj\My Documents\reports.csv' could not be found. Check the spelling the file name, and verify that the file location correct.
    If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, deleted.


    But I copy the link in cell A1 and put in my web browser url path by manually, then its working(downloading) the file. The above code is not supports to download the file from secured(https://) server, is it?

    PS: The same code has worked fine in my colleague's system for some time(NOT ALL THE TIMES). Sometime they are also getting the same error message.

    Hi Patel, thanks for the code. But the result seems like above error for some time.

    Regards,
    Chinraj

+ 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. Download excel file from website
    By Sharpbangbang in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-10-2013, 12:08 PM
  2. VBA - Go to website and download file from save prompt
    By randiba in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2013, 08:33 PM
  3. HTML dialog box to download file from website
    By CJK in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-08-2012, 12:19 PM
  4. file download from website
    By dgkindy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2009, 10:39 AM
  5. Replies: 2
    Last Post: 01-17-2006, 01:40 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