Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Open txt file without changing date

I am struggling with the problem that MS changed the txt import
procedure in Excel. We open txt files in Excel automatically from our
ERP system. The ERP system creates a txt file (in this file all dates
are fine), than Excel starts and through VBA the txt file is opened
and some manupilation is done.

The problem now is that dates are changed to numbers in the wrong
format. In the txt files I have the following dates:

23-01-2008 ddmmyyyy
30-02-2008 ddmmyyyy
07-03-2008 ddmmyyyy
10-04-2008 ddmmyyyy

The first two dates are well displayed in Excel after import, but the
other two are displayed as numbers. If I go into the cell properties
and change the field to date, the date displayed is

03-07-2008 mmddyyyy (note that the date format is still ddmmyyyy)
04-10-2008 mmddyyyy (note that the date format is still ddmmyyyy)

And this is very frustrating, Excel swithces the days and the months
if this is possible. Why can Excel not just import the txt file as it
is? Of course I can use VBA to find this dates and format them as
mmddyyyy, but in my opinion that can not be the way.

I would like to know if there is a way to import the txt file in Excel
and that the dates are displayed as they should.

Thanks in advance.

Dirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Open txt file without changing date

Try formating the cells before you import the data. I sually write my own
VBA code to import Test files because of ALL the problems people have with
excel translation the imported data incorrectly.

"Doekoe" wrote:

I am struggling with the problem that MS changed the txt import
procedure in Excel. We open txt files in Excel automatically from our
ERP system. The ERP system creates a txt file (in this file all dates
are fine), than Excel starts and through VBA the txt file is opened
and some manupilation is done.

The problem now is that dates are changed to numbers in the wrong
format. In the txt files I have the following dates:

23-01-2008 ddmmyyyy
30-02-2008 ddmmyyyy
07-03-2008 ddmmyyyy
10-04-2008 ddmmyyyy

The first two dates are well displayed in Excel after import, but the
other two are displayed as numbers. If I go into the cell properties
and change the field to date, the date displayed is

03-07-2008 mmddyyyy (note that the date format is still ddmmyyyy)
04-10-2008 mmddyyyy (note that the date format is still ddmmyyyy)

And this is very frustrating, Excel swithces the days and the months
if this is possible. Why can Excel not just import the txt file as it
is? Of course I can use VBA to find this dates and format them as
mmddyyyy, but in my opinion that can not be the way.

I would like to know if there is a way to import the txt file in Excel
and that the dates are displayed as they should.

Thanks in advance.

Dirk

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
Changing file/open and file/saveas directories jamjam Excel Programming 1 November 30th 07 04:48 PM
Open Test file with VBA with a changing file number Michael from Austin Excel Programming 4 October 14th 05 03:18 PM
When I open my past invoice it keeps changing date to todays date Stop date changing to todays in Excel Excel Worksheet Functions 2 October 7th 05 04:54 PM
Problem changing open file from R/0 to R/W Scampa7[_9_] Excel Programming 0 February 10th 04 03:38 PM
Open delimited text file to excel without changing data in that file zohanc Excel Programming 1 October 3rd 03 01:06 AM


All times are GMT +1. The time now is 06:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"