LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
MaxFrance
 
Posts: n/a
Default

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
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
I get a program error when I download an excel template Ladybug Excel Discussion (Misc queries) 3 March 4th 05 12:02 AM
html to excel nellie Excel Discussion (Misc queries) 4 February 8th 05 10:37 PM
Merge from Excel to Excel dalstar Excel Discussion (Misc queries) 3 January 30th 05 02:37 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM
Shortcut file fails to open JimH Excel Discussion (Misc queries) 3 January 15th 05 10:13 PM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"