View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jasonc jasonc is offline
external usenet poster
 
Posts: 13
Default Date format Workbooks Open

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 DataText 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?