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

Hi all,

The following is code snippet whereby l am copying a worksheet to make
a seperate Excel workbook and then if certain criteria are met l also
save the file as a text file.

The original .xls file has the correct date format (dd/mm/yy), the
worksheet saved as .xls has the same correct date format (dd/mm/yy)
but the saved .txt file when opened in notepad has the incorrect date
format (mm/dd/yyyy)

Regional settings are correct (English UK)

I have also tried adding Local:=True to the code.

But the really frustrating thing is that if l manually copy the sheet
and save as a txt file the date appears correctly !

Can anybody please help?

Code - beware word wrapping

If MyWBname < "FT CC Report (2).xls" Then
ActiveWorkbook.SaveAs WBpath & MyWBname
If MyWBname Like "??? Journal.xls" Then
If MyWBname < "EDE Journal.xls" Then
ActiveWorkbook.SaveAs WBpath & Left
(MyWBname, Len(MyWBname) - 4), FileFormat:=xlText, Local:=True,
CreateBackup:=False


End If
End If
ActiveWorkbook.Close True
Else
ActiveWorkbook.Close False
End If

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Mysterious re date Format

When you say "has the correct date format" is that simply the default
International date format you have in your system. If so try changing it
slightly, eg

Select your cells, Ctrl-1, custom
dd/mm/yy;@

or with code
rng.numberformat = "dd/mm/yy;@"

Regards,
Peter T

"michael.beckinsale" wrote in message
...
Hi all,

The following is code snippet whereby l am copying a worksheet to make
a seperate Excel workbook and then if certain criteria are met l also
save the file as a text file.

The original .xls file has the correct date format (dd/mm/yy), the
worksheet saved as .xls has the same correct date format (dd/mm/yy)
but the saved .txt file when opened in notepad has the incorrect date
format (mm/dd/yyyy)

Regional settings are correct (English UK)

I have also tried adding Local:=True to the code.

But the really frustrating thing is that if l manually copy the sheet
and save as a txt file the date appears correctly !

Can anybody please help?

Code - beware word wrapping

If MyWBname < "FT CC Report (2).xls" Then
ActiveWorkbook.SaveAs WBpath & MyWBname
If MyWBname Like "??? Journal.xls" Then
If MyWBname < "EDE Journal.xls" Then
ActiveWorkbook.SaveAs WBpath & Left
(MyWBname, Len(MyWBname) - 4), FileFormat:=xlText, Local:=True,
CreateBackup:=False


End If
End If
ActiveWorkbook.Close True
Else
ActiveWorkbook.Close False
End If



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
permanent conversion of 1904 date format to 1900 date format Jos Excel Worksheet Functions 4 November 26th 15 02:48 PM
change date format dd/mm/yyyy to Julian date format? itzy bitzy Excel Worksheet Functions 1 December 8th 09 07:42 PM
Convert european foreign date format to US date format EAL Excel Worksheet Functions 1 May 14th 09 10:02 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
Change a date in text format xx.xx.20xx to a recognised date format concatenator Excel Programming 1 November 24th 03 11:33 PM


All times are GMT +1. The time now is 12:28 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"