+ Reply to Thread
Results 1 to 6 of 6

Trouble when saving as a .csv file

  1. #1
    Registered User
    Join Date
    08-30-2007
    Posts
    6

    Trouble when saving as a .csv file

    I have a macro that producuses 12 report (one for each month).
    Every report is saved both in xls format and in csv format.

    But when I open one of the csv files created, all information is in the first column. They are separated with comma alright, but I want it in different columns just like the xls-file.

    This is an abstract from the code:

    fbook is the report I'm working with. Any help is very appreciated thanxs!

    /Kjell B

    Range("A1").Select
    Selection.CurrentRegion.Select
    Selection.NumberFormat = "General"
    ChDir indatafile.Path
    fbook.SaveAs "In data Forecast WBS_IO " & Format(Date, "YY") & Format(i, "00") & "F3 - " & Format(Date, "YYYY-MM-DD") & ".xls"
    Range("H:S").EntireColumn.Delete
    Columns(1).Delete
    fbook.SaveAs "In data Forecast WBS_IO " & Format(Date, "YY") & Format(i, "00") & "F3 - " & Format(Date, "YYYY-MM-DD") & ".csv", FileFormat:=xlCSV
    Sheets(1).Name = Format(Date, "YY") & Format(i, "00") & "F3"
    fbook.Save
    fbook.Close

  2. #2
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    If you are working with a dutch excel version i might have the solution.

    Change your settings to a comma for thousands an a point for decimals

  3. #3
    Registered User
    Join Date
    08-30-2007
    Posts
    6
    I have an english of excel, but Windows XP is in swedish and I have swedish regional settings on my computer.

  4. #4
    Registered User
    Join Date
    08-30-2007
    Posts
    6
    Another strange thing is that when i use File, save as in csv format, then it works. But when I use code for it does´nt.

  5. #5
    Forum Contributor
    Join Date
    03-24-2004
    Location
    Edam Netherlands
    Posts
    181
    Then you can compare the files in notepad...

  6. #6
    Registered User
    Join Date
    08-30-2007
    Posts
    6
    Thanks for the idea!

    When I save using File, save as csv command, the columns in the file are separeted with semicolon (. But when I run the macro and save as csv, the columns are separated with comma (,).

    Can I change so that the columns are separated with semicolon when I run the macro?

+ 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