PC Review


Reply
Thread Tools Rate Thread

Date format Workbooks Open

 
 
JasonC
Guest
Posts: n/a
 
      23rd Feb 2010
I have an application which saves the output to .xls format. If I open the
file from Excel, I get the Text Import Wizard. There is a date/time column
in format
dd/mm/yyyy hh:mm

However, If I use Application.Workbooks.Open to open the file, the date/time
column is in format dd/mm/yy hh:mm

ie the yyyy is shortened to 2 digits.

Manually clicking into a cell and pressing enter updates the cell, as does
Text to Columns. I have recorded some code to use Data>Text to Columns, but
running the code does nothing. If the dates are in column L, the code is as
follows:

Columns("L:L").Select
Selection.TextToColumns Destination:=Range("L1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False,
FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True

I have tried different methods of opening the file and of delimiting the
text after it is open, but can't get the date correct.

Can anyone help?
 
Reply With Quote
 
 
 
 
Bob Bridges
Guest
Posts: n/a
 
      23rd Feb 2010
I'm missing something: If your output is saved to .xls format, how is it
possible that when you open it again it fires up the Text Import wizard? Is
it a text file or a workbook? Sounds to me as though your app is improperly
saving it as a text file with an .xls extension.

--- "JasonC" wrote:
> I have an application which saves the output to .xls format. If I open the
> file from Excel, I get the Text Import Wizard. There is a date/time column
> in format dd/mm/yyyy hh:mm. However, If I use Application.Workbooks
> .Open to open the file, the date/time column is in format dd/mm/yy hh:mm
> ie the yyyy is shortened to 2 digits.
>
> Manually clicking into a cell and pressing enter updates the cell, as does
> Text to Columns. I have recorded some code to use Data>Text to Columns, but
> running the code does nothing. If the dates are in column L, the code is as
> follows:
>
> Columns("L:L").Select
> Selection.TextToColumns Destination:=Range("L1"), DataType:=xlDelimited, _
> TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
> Tab:=True, _
> Semicolon:=False, Comma:=False, Space:=False, Other:=False,
> FieldInfo _
> :=Array(1, 4), TrailingMinusNumbers:=True
>
> I have tried different methods of opening the file and of delimiting the
> text after it is open, but can't get the date correct.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
all cells in 2 workbooks have automaticlly changed to date format dloc Microsoft Excel Worksheet Functions 1 12th Feb 2010 07:16 PM
VBA Excel.WorkBooks.Open can't open an XML format xls file =?Utf-8?B?Z2lhbnRkaW5v?= Microsoft Excel Programming 2 14th Aug 2007 03:12 PM
Open form code to enter a date in short date format =?Utf-8?B?VGFuZHk=?= Microsoft Access Form Coding 5 5th Jul 2005 07:05 PM
Workbooks.Open incorrectly formating date column =?Utf-8?B?UGF1bA==?= Microsoft Excel Programming 3 28th Oct 2004 06:30 PM
Excel VBA - Activate Open Workbooks to format exceller Microsoft Excel Programming 2 10th Jun 2004 12:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:17 PM.