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: 8
Default Reading dates from text file

Hi

I have a comma-separated text file with several pieces of data in it. I'm
doing this sort of thing to read them in:

Dim ID
Dim DateVar
Dim Name
Dim CodeNo
Open "import.txt" For Input As #1
Do Until EOF(1)
Input #1, ID
Input #1, DateVar
Input #1, Name
Input #1, CodeNo
'Data processing code here
Loop
Close #1

The trouble is that the dates aren't reading in properly. The lines in the
file are in this format:

1,13/03/2004,Chris,4745
2,27/06/2004,Josh,5684
etc.

The problem is that after running the code above, the DateVar variable only
holds the day, not the month (ie. 13 instead of 13/03/2004). If I change Dim
DateVar to Dim DateVar As Date, then I get an Overflow (RTE 6).

Any ideas as to how to get the date reading properly?

Thanks
Chris

 
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
Copnvert dates reading as Text to a date format Margy Excel Discussion (Misc queries) 5 February 9th 09 06:53 PM
Reading from a text file Jeff Excel Discussion (Misc queries) 1 November 8th 06 08:47 PM
Reading a text file ? WTG Excel Worksheet Functions 2 February 22nd 05 01:29 AM
Reading a text file WTG Excel Discussion (Misc queries) 2 February 22nd 05 01:27 AM
Help reading in a text file Mike[_60_] Excel Programming 1 January 21st 04 06:29 PM


All times are GMT +1. The time now is 03:04 AM.

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

About Us

"It's about Microsoft Excel"