+ Reply to Thread
Results 1 to 7 of 7

save all csv as xls

  1. #1
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    save all csv as xls

    Hello,

    I would like to save all csv files as xls in a directory.
    I have created the attached macro, but the problem is, that in case this macro opens and save the csv files, the separation will be lost, data are separated by semicolon will be merged in one cel.
    I tried to use the opentext method, but I couldn't manage to use it on all files in a directory.

    Could anybody help, how to deal with this problem?


    Thanks

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by HarryKlein; 06-05-2011 at 06:49 AM. Reason: test file attached

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: save all csv as xls

    Whether the semicolon will be used as a fieldseparator is dependent on windows international settings.
    If you change the fieldseparator into a semicolon there there shouldn't be any problem any more.

    Please Login or Register  to view this content.



  3. #3
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    Re: save all csv as xls

    Thanks, I checked the windows settings, and the fieldseparator is set to semicolon.
    Your code is more efficient that my one, I am happy to have the possibility to learn.

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: save all csv as xls

    It would be interesting to know the contents of files that won't be parsed to columns, although they contain the semicolon as fieldseparator.

  5. #5
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    Re: save all csv as xls

    I have attached a sample

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: save all csv as xls

    Your eyes must be better than mine...

    I found it.

    The only problem in that file is that you forgot hyphenation after the fieldname 'field2'.
    If I save that file as an csv-file it's only that problem not parsing to columns.; everything else in that file turns out to be correct.
    Last edited by snb; 06-03-2011 at 09:41 AM.

  7. #7
    Forum Contributor
    Join Date
    05-10-2011
    Location
    Budapest, Hungary
    MS-Off Ver
    Excel 2016
    Posts
    187

    Re: save all csv as xls

    Thank you for the help

+ 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