Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I set the delimiter to save as a CSV?

How do I set the delimiter when I save a file in CSV format, if my system
settings have the delimiter set to semicolon the saved CSV will automatically
alse be semicolon delimited. I want to be able to define the delimiter when
using the SaveAs method.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How do I set the delimiter to save as a CSV?

Maybe you could use a macro that writes your data:

Earl Kiosterud's Text Write program:
www.smokeylake.com/excel
(or directly: http://www.smokeylake.com/excel/text_write_program.htm)

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html

======
Earl's may be sufficient right out of the box. He supports lots of options.

Jeroen Hofs wrote:

How do I set the delimiter when I save a file in CSV format, if my system
settings have the delimiter set to semicolon the saved CSV will automatically
alse be semicolon delimited. I want to be able to define the delimiter when
using the SaveAs method.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default How do I set the delimiter to save as a CSV?

AFAIK, XL will always use the system settings.

See

http://www.mcgimpsey.com/excel/textfiles.html

for a workaround.


In article ,
"Jeroen Hofs" <Jeroen wrote:

How do I set the delimiter when I save a file in CSV format, if my system
settings have the delimiter set to semicolon the saved CSV will automatically
alse be semicolon delimited. I want to be able to define the delimiter when
using the SaveAs method.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How do I set the delimiter to save as a CSV?

Thanks Dave!
I'll check it out right away.
Jeroen

"Dave Peterson" wrote:

Maybe you could use a macro that writes your data:

Earl Kiosterud's Text Write program:
www.smokeylake.com/excel
(or directly: http://www.smokeylake.com/excel/text_write_program.htm)

Chip Pearson's:
http://www.cpearson.com/excel/imptext.htm

J.E. McGimpsey's:
http://www.mcgimpsey.com/excel/textfiles.html

======
Earl's may be sufficient right out of the box. He supports lots of options.

Jeroen Hofs wrote:

How do I set the delimiter when I save a file in CSV format, if my system
settings have the delimiter set to semicolon the saved CSV will automatically
alse be semicolon delimited. I want to be able to define the delimiter when
using the SaveAs method.


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I set the delimiter to save as a CSV?


Code:
--------------------

'===============================================
'- MACRO TO CONVERT WORKSHEET TO
'- PIPE (or other) DELIMITED TEXT FILE
'- WS HAS TO BE SET UP AS A SIMPLE TABLE
'- RUN MACRO FROM THE SHEET
'- Should run on any sheet
'- Brian Baulsom April 2002
'===============================================
'-
Sub PipeDelimited()
Dim FileName As String
Dim MyRow As Long
Dim MyCol As Integer
Dim MyReturn As String
Dim ws As Worksheet
Dim LastRow As Long
Dim ColumnCount As Integer
Dim MyDelimiter As String
'--------------------------------------------
'- set the delimiter
MyDelimiter = "|"
'--------------------------------------------
Set ws = ActiveSheet
MyReturn = Chr(13)
FileName = ws.Name & ".txt"
Open FileName For Append As #1
'------------------------------
'- get number of rows
LastRow = ws.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByRows).Row
'--------------------------------------------
'- get number of columns
ColumnCount = ws.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, _
SearchOrder:=xlByColumns).Column
'--------------------------------------------
'- loop through rows & columns
For MyRow = 1 To LastRow
For MyCol = 1 To ColumnCount
Print #1, ws.Cells(MyRow, MyCol).Value;
If MyCol < ColumnCount Then Print #1, MyDelimiter;
Next
Print #1, MyReturn; ' end of line Return
Next
'----------------------------------------------
Close #1
MsgBox ("Done")
End Sub

'--------------------------------------------------

--------------------


--
BrianB


------------------------------------------------------------------------
BrianB's Profile: http://www.excelforum.com/member.php...info&userid=55
View this thread: http://www.excelforum.com/showthread...hreadid=388031

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save delimited format, specify delimiter, remove quotes from text HotPepper Excel Discussion (Misc queries) 2 October 21st 09 08:53 PM
save as CSV - changing delimiter george m Excel Discussion (Misc queries) 6 January 23rd 08 09:38 PM
Excel: save-as csv : delimiter set to semi-colon, not comma. Why? Luke Skywalker Excel Discussion (Misc queries) 1 August 7th 06 02:18 PM
Comma delimiter Jon Quixley Excel Worksheet Functions 1 July 25th 06 04:47 PM
How can I save Excel am spreadsheet as pipe delimiter? Sarah Excel Discussion (Misc queries) 5 May 25th 06 08:36 PM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"