Problem with OpenText in Excel 2000 (date format)

S

sorin

I am writing a macro to import data in a txt file (tab delimited
values) for further processing.

Until this date issue everything worked out just fine... :(

I have a column that contains dates (actually timestamp) in dd-mm-yyyy
hh:nn format. I modified my opentext call to set DMY format like this:

Call Workbooks.OpenText(Filename:="D:\working\test\data.txt", _
DataType:=xlDelimited, _
DecimalSeparator:=",", ThousandsSeparator:=".",
_
FieldInfo:=Array(Array(15, xlDMYFormat),
Array(16, xlDMYFormat)))

However the resulting column is shown as text (I need this to be a date
because a chart use dates in this column).

If I manually select each cell in this column, press F2 and ENTER
(enter and exit edit mode without modify anything), automatically Excel
recognize the field as Date!

Any idea how to get automatically all column data converted to dates?

regards
 
S

sorin

Testing and testing again just make me realize that a strange thing is
happening:

I record a macro and open text file from Excel menu, works fine.
Run the macro will just fail to convert dates!!!

It seams this feature is not working only for VBA calls!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top