PC Review


Reply
Thread Tools Rate Thread

CSV-file as semicolon se

 
 
Kirchler
Guest
Posts: n/a
 
      10th May 2009

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 With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      10th May 2009
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?
>

 
Reply With Quote
 
joel
Guest
Posts: n/a
 
      10th May 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
export CSV file with semicolon bawahoo Microsoft Excel Programming 2 11th Jul 2006 05:00 PM
Export excel file to semicolon delimited text file capitan Microsoft Excel Discussion 5 7th Apr 2005 03:06 AM
Export excel file to semicolon delimited text file capitan Microsoft Excel Misc 5 7th Apr 2005 03:06 AM
How to link semicolon separated file =?Utf-8?B?VmFsZW50aW5h?= Microsoft Access VBA Modules 3 11th Mar 2005 01:29 PM
semicolon separated CSV file =?Utf-8?B?U3RlZmk=?= Microsoft Excel Misc 4 20th Oct 2004 03:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.