semicolon separated values

  • Thread starter Thread starter saybut
  • Start date Start date
S

saybut

Hi,

I am saving a spreadsheet as a .CSV file to input into a system.

Is there any way of saving a .CSV file but getting excel to us
semicolons as the separator instead of colons?

Any help is greatly appreciated.

Thanks,

Mark
 
You have two choices I believe. You can change your List Separator
character to a semicolon under Windows Control Panel Regional Settings or
you can use a macro to save the file instead of Excels's File, Save As.

''No quotes around strings
''Outputs the selection if more than one cell is selected, else entire sheet
Sub OutputActiveSheetAsTrueCSVFile()
Dim SrcRg As Range
Dim CurrRow As Range
Dim CurrCell As Range
Dim CurrTextStr As String
Dim ListSep As String
Dim FName As Variant
FName = Application.GetSaveAsFilename("", "CSV File (*.csv), *.csv")
If FName <> False Then
ListSep = ";" 'Semicolon is separator
If Selection.Cells.Count > 1 Then
Set SrcRg = Selection
Else
Set SrcRg = ActiveSheet.UsedRange
End If
Open FName For Output As #1
For Each CurrRow In SrcRg.Rows
CurrTextStr = ""
For Each CurrCell In CurrRow.Cells
CurrTextStr = CurrTextStr & CurrCell.Value & ListSep
Next
While Right(CurrTextStr, 1) = ListSep
CurrTextStr = Left(CurrTextStr, Len(CurrTextStr) - 1)
Wend
Print #1, CurrTextStr
Next
Close #1
End If
End Sub


--
Jim Rech
Excel MVP
|
| Hi,
|
| I am saving a spreadsheet as a .CSV file to input into a system.
|
| Is there any way of saving a .CSV file but getting excel to use
| semicolons as the separator instead of colons?
|
| Any help is greatly appreciated.
|
| Thanks,
|
| Mark.
|
|
| --
| saybut
| ------------------------------------------------------------------------
| saybut's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=5949
| View this thread: http://www.excelforum.com/showthread.php?threadid=265015
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top