Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date format in excel

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default date format in excel

Hi Frank

Thanks very much for that, I know I could amend it, in
the vb script, but was looking to find the main fix
instead of having to check when writing more macro's.

Cheers
Jonathan

-----Original Message-----
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 news:75E021E9-2179-41B5-8965-

...
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


.

Reply
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
Excel 2007 format cells to date format Stefan Excel Discussion (Misc queries) 0 June 1st 10 09:06 PM
Excel Format Problem - Date Overrides Format Mary Excel Discussion (Misc queries) 5 February 10th 10 05:49 AM
Change satellite julian date format YYYYDDDHHMMSS to excel date ti putley Excel Discussion (Misc queries) 1 January 11th 08 06:12 PM
How can I convert a date format to an ISO week format (in EXCEL)? ELI Excel Discussion (Misc queries) 2 July 6th 05 06:31 PM
Excel 2000 date format cannot be set to Australian date format Brian Jones Excel Discussion (Misc queries) 1 March 30th 05 06:03 AM


All times are GMT +1. The time now is 06:34 PM.

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"