View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
SeanC UK[_3_] SeanC UK[_3_] is offline
external usenet poster
 
Posts: 48
Default Export to CSV file problems

Hi Ixtreme,

The problem is that when you automate the save process it is using the
language of VBA and not the regional settings.

Simply add the extra argument to your command and it should use the regional
settings:

ActiveWorkbook.SaveAs Filename:= _
"C:\FILES\TEST.csv", _
FileFormat:=xlCSV, CreateBackup:=False _
Local:=True


This should do the trick (in The Netherlands or Denmark ;-) ).

Hope this helps,

Sean.

--
(please remember to click yes if replies you receive are helpful to you)


"Ixtreme" wrote:

Hi all,

I have MS Excel 2002 SP3 installed.
I need to create a CSV file with ~ as the delimiter. I customized my
current (dutch) Regional settings List delimiter to ~. So far so good.
Once I open my excel file and do a save as, select CSV file and click
on Save, I have exactly what I need. Upon opening the file with
Notepad, all records are separeted with ~.

However, I would like to automate this. I record a macro of the above
action which resulted in something like this:

ActiveWorkbook.SaveAs Filename:= _
"C:\FILES\TEST.csv", _
FileFormat:=xlCSV, CreateBackup:=False

But If I open that file with Notepad, all fields are separeted by
comma's :-(

The questions is: WHY? and how can I prevent this from happening? I
want my ~ as the delimiter.