B
belitre
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
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