ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with the file format xlCSV and a field separator (https://www.excelbanter.com/excel-programming/327878-problem-file-format-xlcsv-field-separator.html)

sarimari

Problem with the file format xlCSV and a field separator
 
When I save a sheet using File - Save as.. to a format CSV - the result
looks OK and like this using Notespad:
1;monday;jan;1,11
2; tuesday;feb;2,22

BUT when I'm using a simple marco for the same funtion, the result looks
like this:
1,monday,jan,1.11
2,tuesday,feb,2.22

Why are the field separators different doing function manual or using marco?

Tom Ogilvy

Problem with the file format xlCSV and a field separator
 
Basically VBA uses US English settings.


If you are using a later version of excel, you might look at the LOCAL
argument to SAVEAS:

From Help on SAVEAS:

Local Optional Variant. True saves files against the language of Microsoft
Excel (including control panel settings). False (default) saves files
against the language of Visual Basic for Applications (VBA) (which is
typically US English unless the VBA project where Workbooks.Open is run from
is an old internationalized XL5/95 VBA project).



Believe this was added in xl2002 and later.

--

Regards,

Tom Ogilvy



"sarimari" wrote in message
...
When I save a sheet using File - Save as.. to a format CSV - the result
looks OK and like this using Notespad:
1;monday;jan;1,11
2; tuesday;feb;2,22

BUT when I'm using a simple marco for the same funtion, the result looks
like this:
1,monday,jan,1.11
2,tuesday,feb,2.22

Why are the field separators different doing function manual or using

marco?



keepITcool

Problem with the file format xlCSV and a field separator
 
if you have xlXP or newer:
use local:=true in the saveas statement.

when saving files from the UI this argument is true,
whereas from VBA it defaults to false...

same goes for OpenText



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


sarimari wrote :

When I save a sheet using File - Save as.. to a format CSV - the
result looks OK and like this using Notespad:
1;monday;jan;1,11
2; tuesday;feb;2,22

BUT when I'm using a simple marco for the same funtion, the result
looks like this:
1,monday,jan,1.11
2,tuesday,feb,2.22

Why are the field separators different doing function manual or using
marco?


sarimari

Problem with the file format xlCSV and a field separator
 
Thank you so, it worked :)
-sarimari

"Tom Ogilvy" kirjoitti:

Basically VBA uses US English settings.


If you are using a later version of excel, you might look at the LOCAL
argument to SAVEAS:

From Help on SAVEAS:

Local Optional Variant. True saves files against the language of Microsoft
Excel (including control panel settings). False (default) saves files
against the language of Visual Basic for Applications (VBA) (which is
typically US English unless the VBA project where Workbooks.Open is run from
is an old internationalized XL5/95 VBA project).



Believe this was added in xl2002 and later.

--

Regards,

Tom Ogilvy



"sarimari" wrote in message
...
When I save a sheet using File - Save as.. to a format CSV - the result
looks OK and like this using Notespad:
1;monday;jan;1,11
2; tuesday;feb;2,22

BUT when I'm using a simple marco for the same funtion, the result looks
like this:
1,monday,jan,1.11
2,tuesday,feb,2.22

Why are the field separators different doing function manual or using

marco?




sarimari

Problem with the file format xlCSV and a field separator
 
Thank you, the problem is solved :)
Have a great weekend!
-sarimari

"keepITcool" kirjoitti:

if you have xlXP or newer:
use local:=true in the saveas statement.

when saving files from the UI this argument is true,
whereas from VBA it defaults to false...

same goes for OpenText



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


sarimari wrote :

When I save a sheet using File - Save as.. to a format CSV - the
result looks OK and like this using Notespad:
1;monday;jan;1,11
2; tuesday;feb;2,22

BUT when I'm using a simple marco for the same funtion, the result
looks like this:
1,monday,jan,1.11
2,tuesday,feb,2.22

Why are the field separators different doing function manual or using
marco?




All times are GMT +1. The time now is 02:16 PM.

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