+ Reply to Thread
Results 1 to 6 of 6

import csv macro for excel 2000 and up

  1. #1
    Registered User
    Join Date
    02-13-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    import csv macro for excel 2000 and up

    I have a macro assigned to a button that is used to import a csv file into an existing sheet named "Data". The macro was created using Excel 2010. I would like the macro to also work in all previous versions back to Excel 2000. Is it possible to adapt the code to work on Excel 2000 and up? Below is the code I am using. Thanks in advance!


    Please Login or Register  to view this content.
    Last edited by Leith Ross; 02-17-2013 at 04:21 PM. Reason: Added Code Tags

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: import csv macro for excel 2000 and up

    Have you tried this on Excel 2000?
    Did it fail?

    When you compile or DEBUG the error, which line is highlighted?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-13-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: import csv macro for excel 2000 and up

    Thanks for taking the time to help me. When I select the import data button using Excel 2000, I get "Run-time error 438" displayed. Debugging shows highlighted in yellow the following:

    With Application.FileDialog(msoFileDialogFilePicker)
    Last edited by catchg; 02-18-2013 at 01:40 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: import csv macro for excel 2000 and up

    A couple of other techniques to test, see if you can get the results you need:

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-13-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: import csv macro for excel 2000 and up

    I've tried the 2 techniques you suggested and can not get the file open dialog window on XL 2000. I read the following info at:

    http://support.microsoft.com/kb/213371/en-us

    So, I tried the code from the link above and the file dialog window appears in XL 2000 and imports the csv data into a new workbook. The code follows:

    Please Login or Register  to view this content.
    As you can see in my original post, I am trying to import the csv data into an existing worksheet named "Data" (Range f6). I believe the way QueryTable was coded back then also needs to be considered. Any suggestions to have the imported data load into the existing sheet named "Data" when using XL 2000 version and up would be greatly appreciated. Thanks!

  6. #6
    Registered User
    Join Date
    02-13-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: import csv macro for excel 2000 and up

    JBeaucaire, I am able to get the file dialog box to open in Excel 2000 with the code I posted in reply above. It loads the csv into a new workbook. Could you kindly give me some suggestions how to load the csv data into an existing sheet named "Data" starting in cell F6. Please keep in mind I am trying to write the macro to import csv into existing sheet named "Data" that works on excel versions 2000 to 2013. Any suggestions would be appreciated. Thanks!

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: import csv macro for excel 2000 and up

    Turn on the macro recorder and let it record you doing an Import Data from File routine. That recorded macro can then be tweaked to use the one of the "get filename" methods you've already explored and insert that filename into the macro you recorded at the appropriate spot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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