Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CSV-file as semicolon se


I have the merge some date in Excel 2003 and convert the output file to a
csv-file. I have made a Visual Basic program, which import the data and
create a csv-file. However the csv-file must be semi-colon separated. I have
changed the Regional and Language settings, so the list separator is
semi-colon.

I have tried to save the Excel file as csv-file manually, and the result
looks OK. However, I want to use Visual Basic to do both the import of data
and creation of the csv-file. The problem is that Visual Basic creates the
csv-file as comma separated €“ no matter of my regional and language settings.
How can I get the output file as semi-colon separated?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default CSV-file as semicolon se

Try the below macro to generate a file with semi-colon separated values.
Specify the number of columns and number of rows....or you can get the last
col and last row...Launch VBE using Alt+F11. Insert module and copy the below
code...Try with the active sheet...


Sub OutputAsSCV()

Dim lngRow As Long
Dim lngCol As Long
Dim lngLastRow As Long
Dim lngLastCol As Long
Dim intFile As Integer
Dim strData As String
intFile = FreeFile

lngLastRow = 2
lngLastCol = 3

Open "c:\test.txt" For Output As #intFile
For lngRow = 1 To lngLastRow
strData = ""
For lngCol = 1 To lngLastCol
strData = strData & ";" & Cells(lngRow, lngCol)
Next lngCol
Print #intFile, Mid(strData, 2)
Next lngRow
Close #intFile

End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Kirchler" wrote:


I have the merge some date in Excel 2003 and convert the output file to a
csv-file. I have made a Visual Basic program, which import the data and
create a csv-file. However the csv-file must be semi-colon separated. I have
changed the Regional and Language settings, so the list separator is
semi-colon.

I have tried to save the Excel file as csv-file manually, and the result
looks OK. However, I want to use Visual Basic to do both the import of data
and creation of the csv-file. The problem is that Visual Basic creates the
csv-file as comma separated €“ no matter of my regional and language settings.
How can I get the output file as semi-colon separated?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default CSV-file as semicolon se

I don't know all the international settings but check you VBa help menu fro

FileFormat Property

the file format can be used with SAVEAS to specify the type of file you are
saving. Do you have in your worksheet menu File - SAVEAS an option to save
as semicolon delimited? If you have an option in the menu then there should
be an option in VBA SAVEAS.

"Kirchler" wrote:


I have the merge some date in Excel 2003 and convert the output file to a
csv-file. I have made a Visual Basic program, which import the data and
create a csv-file. However the csv-file must be semi-colon separated. I have
changed the Regional and Language settings, so the list separator is
semi-colon.

I have tried to save the Excel file as csv-file manually, and the result
looks OK. However, I want to use Visual Basic to do both the import of data
and creation of the csv-file. The problem is that Visual Basic creates the
csv-file as comma separated €“ no matter of my regional and language settings.
How can I get the output file as semi-colon separated?

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
export CSV file with semicolon bawahoo[_6_] Excel Programming 2 July 11th 06 05:00 PM
Export excel file to semicolon delimited text file capitan Excel Discussion (Misc queries) 5 April 7th 05 03:06 AM
Need help : Open a csv file with semicolon separation Yann59 Excel Programming 2 August 24th 04 01:50 PM
save a csv file with SEMICOLON delimiters mariofontaine Excel Programming 2 May 5th 04 03:38 PM
ADO & semicolon delimited text file? raj Excel Programming 4 January 6th 04 08:31 PM


All times are GMT +1. The time now is 08:32 PM.

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"