Home |
Search |
Today's Posts |
#7
![]() |
|||
|
|||
![]()
Okay,
I modified your macro to take into effect the automatic save of a specfic name each time, and changed the delimiter. It's perfect. Thanks for you help - it's cured a major headache. "Jim Rech" wrote: If there are commas in your data then you will get quotes with a macro, despite having French setting (I assume). When a macro runs Excel is thrown into "US settings mode" where a comma is the list separator. In order to distinguish separator commas from data commas quotes are used. You might try using this macro which gives you more control over the output: ''No quotes around strings ''Outputs the selection if more than one cell is selected, else entire sheet Sub OutputActiveSheetAsTrueCSVFile() 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) 'ListSep = "," 'use this to force commas as separator regardless of regional settings 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 -- Jim Rech Excel MVP "MaxFrance" wrote in message ... | If I save (using a macro) an excel file as a text file MSDOS (not tab | delimited), I get a file with quotation marks at the start and end of each | line! If I do the process manually the file is perfect. Can someone help !! | | Excel 2000 all updates done | XP prof all updates done (with sp2) | | Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I get a program error when I download an excel template | Excel Discussion (Misc queries) | |||
html to excel | Excel Discussion (Misc queries) | |||
Merge from Excel to Excel | Excel Discussion (Misc queries) | |||
Excel 2002 and 2000 co-install. Control Which Starts ? | Excel Discussion (Misc queries) | |||
Shortcut file fails to open | Excel Discussion (Misc queries) |