+ Reply to Thread
Results 1 to 7 of 7

CSV Semicolon Comma problem with Macro.

  1. #1
    Registered User
    Join Date
    02-28-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    3

    CSV Semicolon Comma problem with Macro.

    Good Day Everybody,

    We have a slight problem with a macro when we save a xls to csv file when using a macro to do this.

    We made the following macro which saves the current file as a CSV file:

    Please Login or Register  to view this content.


    When we use the macro it saves the CSV file with a comma, but we require a semicolon.
    When we save the file manually it always uses a semicolon, because keyboard-settings are on ;

    What do we forget ?

    Thanks and regards,

    Raymond
    Last edited by arlu1201; 03-05-2013 at 06:00 AM. Reason: Use code tags in future.

  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: CSV Semicolon Comma problem with Macro.

    Local:=True means the delimiter should be coming from your computer's Control Panel setting for delimiter.

    http://screencast.com/t/hWH00ju2wu
    _________________
    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-28-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: CSV Semicolon Comma problem with Macro.

    Thnx for your reply

    Yeah I got that configured as a semicolon. Can it be that I use 64bit windows 7, to configure it somewhere else in 64bit directory.

    Or can we add a line which states to always use a semicolon

    I tried Semicolon:=true but the macro doesnt like that line

  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: CSV Semicolon Comma problem with Macro.

    No, CSV is a comma delimited file type, that's what it IS. The Local:=True setting is supposed to allow you to override that default with your own system's default delimiter. That's really it, that's suppposed to do exactly what you're trying to do.

  5. #5
    Registered User
    Join Date
    02-28-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: CSV Semicolon Comma problem with Macro.

    Sir, Thanks for your replies. I finally found out what somehow caused the problem, which sounds really strange.....
    In the macro we added: Activewindow.Close to close the CSV file.

    Due to a VBA error (i was keeping adding lines) the file was not closed by the macro, but the " ; " was in the CSV file

    Deleted the line for auto-close the CSV and now always " ; " are the separators.

    Even when i close the csv by myself and overwrite the save.

    Thanks for your replies and have a nice day!

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: CSV Semicolon Comma problem with Macro.

    Maybe try this:

    Please Login or Register  to view this content.
    It opens the csv file, reads the contents, and converts all commas into semicolons.

    Hope this helps.

    abousetta
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  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: CSV Semicolon Comma problem with Macro.

    Then perhaps take a little control over the reference workbook being created. Does this do any better:

    Please Login or Register  to view this content.

+ 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