+ Reply to Thread
Results 1 to 5 of 5

VBA: Import CSV file into an Excel Workbook with user defined file name and directory

  1. #1
    Registered User
    Join Date
    12-06-2011
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    24

    VBA: Import CSV file into an Excel Workbook with user defined file name and directory

    I have an Excel Workbook where I need to allow the user to:

    1. Select a csv file (user needs to be able to select both the file name and the directory)
    2. Open the file
    3. Save the csv file to a worksheet within the workbook

    I have been unable to find or craft a solution myself to accomplish these tasks in a single macro. Any solutions or suggestions would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,715

    Re: VBA: Import CSV file into an Excel Workbook with user defined file name and directory

    Hi
    how will the macro know which directories to offer the user - do you have a list?

  3. #3
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,715

    Re: VBA: Import CSV file into an Excel Workbook with user defined file name and directory

    Hi

    this macro will offer the user a list of all the csv files in the specified directory, open the nominated file and copy its sheets to the end of the active workbook.

    If you also want the user to choose the directory, let me know how to establish the list

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-06-2011
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: VBA: Import CSV file into an Excel Workbook with user defined file name and directory

    Nicky,

    Thanks for the assistance. I want the user to essentially be able to chose any directory, as if they were using the File Open dialogue box.

    They will pick a single csv file and the data from the csv file will be copied onto a cleared worksheet named "MLS Feed"

    Larry

  5. #5
    Registered User
    Join Date
    06-26-2012
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: VBA: Import CSV file into an Excel Workbook with user defined file name and directory

    Thank you for the code.
    Last edited by magdy; 09-18-2012 at 05:02 AM.

+ 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