Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Long Beach, California, USA
    Posts
    233
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Sheet name changes when saved in CSV format (XL2000)

    I haven't worked much with the CSV format and have had no success in finding an answer or a work around to this. I am building a worksheet that has data input from a user form and then is saved as a CSV file. When the sheet is saved, the sheet name changes to file name. If I change the sheet name back and close the file and I answer yes to saving changes ...

    ...the sheet name is changed back to the file name.

    This is not too big of a deal except for the fact that it is bugging the stuffing out of me. Is this normal behavior for the CSV file format?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    A CSV file is just a text file, not a spreadsheet. If you open a CSV file in NotePad, you will see that it's just data, separated by the Windows List Separator character - in many countries the comma acts as separator, hence the abbreviation CVS = Comma Separated Values.

    A CSV file stores no information at all on formatting, formulas, sheets etc. - just values.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Long Beach, California, USA
    Posts
    233
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    Thanks Hans for the reply. Guess this is something that I will have to live with.

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    Just a further note to Hans explanation; by virtue of it's structure a CSV file is a single sheet of data which Excel recognizes; one cannot have a multiple sheet CSV.
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Long Beach, California, USA
    Posts
    233
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    Thanks for the further information. Aesthetically it was bothering me that the sheet name shows AL 1 before being saved and Availability Notice_AL 1_ for 01 after having been saved in the CSV format. The file name is: Availability Notice_AL1_ for 010102.csv , apparently the sheet tab will read the same as the file name in a CSV format. I have read that the sheet name can be 31 characters long and as such the reason why the tab shows what it does.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    It is "by design" but can easily be avoided:

    Lets say your csv sheet is (previously) named "ExportSheet":

    Sub myExport()
    Dim oExportsheet as Worksheet
    Dim oCSVBook as Workbook
    set oExportsheet=Thisworkbook.Worksheets("ExportSheet" )
    'create a copy of the exportsheet in a new workbook
    Set oCSVBook=oExportSheet.Copy
    'Save new wrokbook as CSV
    oCSVBook.SaveAs FileName:="CataCSVFilename.CSV",Fileformat:=xlCSV
    ' Close CSV
    oCSVBook.Close False
    End Sub
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  7. #7
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    Jan,

    I have an issue with the following line of code and receive an error message on the copy portion.

    Set oCSVBook = oExportsheet.Copy


    Thanks,
    John

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    The Copy method does not return a result. Use this instead:

    oExportSheet.Copy
    Set oCSVBook = ActiveWorkbook

  9. #9
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Sheet name changes when saved in CSV format (XL2000)

    Which proves I didn't test my solution.

    Thanks.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •