ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save .csv file. English (American) Settings (https://www.excelbanter.com/excel-programming/298531-save-csv-file-english-american-settings.html)

belitre[_3_]

Save .csv file. English (American) Settings
 
I'm using Excel 2000. I have a problem when exporting an excel sheet t
a .csv file with a macro.

I want the decimals to be separated by commas, not by point
(English Settings). Someone in this forum gave me the code to solv
this problem using a macro.

The problem I have now is .. I don't know how to insert that cod
in my macro!!

This is the code:

Sub OutputActiveSheetAsCSVFile()
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 = Application.International(xlListSeparator)
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

I want to use a fix directory to save the file. I also have the nam
of the file in a string variable called varText.

The selection is fixed too (Columns("A:M").Select) , so I think wha
I need must be very simple.

Could anybody help me?

Thanks a lot. Regards

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com