View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default date format in excel

Hi
in VBA use the format method. e.g.
fname = format(Range("B2"),"dd/mm/yyyy")

--
Regards
Frank Kabel
Frankfurt, Germany

"Racketman" schrieb im
Newsbeitrag ...
When manually opening a csv file in excel, a cell ("b2") shows the

date as
'04/10/2004' (dd/mm/yyyy). When opening this file through a macro

using the
following code.
"Workbooks.opnetext filenae:=wmspath$ & "csv\" & datafilename"
The date in cell ("b2") has changed format to '10/04/2004'.

(mm/dd/yyyy)
Does anyone know how to stop this date switching, I have checked

settings in
regional options with short date format of "dd/mm/yyyy".
Cheers Jonathan