Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello all, I have this macro who

Status
Not open for further replies.

DriesM

Programmer
Nov 25, 2001
16
BE
Hello all,

I have this macro who has to save an .xls file into .csv format. This macro is attached to a button.

Private Sub BTNopslaan_Click()
ActiveWorkbook.SaveAs FileName:="F:\alain\DEBVAL.CSV", FileFormat:= _
xlCSVMSDOS, CreateBackup:=False
End Sub

It does the saving with comma's as delimiter. I also tried xlCSV as format.


When I do the saving myself (i.e. via the menu) the semicolumn is used as delimiter. And this is how it's supposed to be.
The semicolumn is the default delimiter in my Windows configuration.

Who knows how to force the use of the semicolumn when the macro is excecuted?


Thanks,
Dries.
 
Well, you are gonna have a problem using CSV and getting semicolon seperators
CSV = COMMA seperated values

What are you saving AS when you do it manually ??

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
Hi Geoff,

I can use

1. "csv seperated by listseperator". (in dutch: lijstscheidingsteken) but it's the default seperator in Windows.
2. "csv os/2 or MS-DOS"

In both cases the semicolumn is used.

Dries.



 
Might be a dumb question but have you recorded yourself doing this save and then looking at the code ??

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
That's how I created the macro in the first place.

 
To be honest, I'm not sure then.....it's probably either a registry setting or the way VBA handles csv files

If you are using XP, try looking at the INTERNATIONAL function in VBA - specifically xlcountrycode - this may need to be set to get the right seperator....
Unfortunately, I'm not sure if this function is available in earlier versions of excel..

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top