LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default importing txt file and wrong date format... MACRO vs MANUAL

Hi,

It looks like a lot of people already encountered that kind of
problem.... but I didn't find any solution to the problem.....

Let's say I have got a TXT file that contains this kind of data :

03/10/06 11:53:54;champ1;champ2;champ3
29/09/06 16:09:48;champ1;champ2;champ3
14/09/06 06:24:35;champ1;champ2;champ3
08/09/06 10:56:45;champ1;champ2;champ3
......


if I import manually, no problem. All dates ar ein the right format..;
If now I record and replay the macro during this process.... Lines 1
and 4 have a date format (but the date has been switched to the
american format....), and lines 2 & 3 have not been recognized as date
format.. (they are left justified, like text)
here is the result :

10/03/2006 11:53 champ1 champ2 champ3
29/09/06 16:09:48 champ1 champ2 champ3
14/09/06 06:24:35 champ1 champ2 champ3
09/08/2006 10:56 champ1 champ2 champ3


Does anybody have any clue ?
As an additional info, by playing and changing the format of the first
column, I can have all 4 lines with TXT format... But I would then need
a macro that would convert the whole column to the right date
format.....

FYI, here is the generated code:

Workbooks.OpenText Filename:= _
fileToOpen, Origin:=437, _
StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=True,
Comma:=False, _
Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1),
Array(2, 1), Array( _
3, 1), Array(4, 1)), TrailingMinusNumbers:=True


Thks,,


AL.

 
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
from date format convert to text format is wrong nooris Excel Discussion (Misc queries) 2 February 4th 10 03:41 PM
date format changes when I save to CSV via a macro, but not manual brawlsadford Excel Discussion (Misc queries) 4 May 17th 07 09:43 AM
Macro gives the wrong date format chin_un_len[_13_] Excel Programming 0 February 25th 06 12:46 AM
How do I change the date format when importing a txt file? vpuckett Excel Worksheet Functions 2 November 28th 05 10:53 PM
Macro with manual file selection? Pmedina Excel Programming 2 June 23rd 05 10:50 PM


All times are GMT +1. The time now is 09:54 PM.

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"