我想分開一個逗號分隔文件,出於某種原因,我似乎沒有得到我期待得到的輸出。VB6逗號分隔CSV文件
下面是代碼:
strCSVPath = "E:\cfaApp\tester.csv"
int77 = FreeFile
Open strCSVPath For Input As #int77
Do Until EOF(int77)
Input #int77, strName, intHours, strMon, strTue, strWed, strThu, strFri, strSat
Debug.Print strName & vbCr & intHours
'Debug.Print strName & vbCr & intHours & vbCr & strMon & vbCr & strTue & vbCr & strWed & vbCr & strThu & vbCr & strFri & vbCr & strSat & vbCr
Loop
輸出看起來是這樣的:
1.0-Store Manager (1 Employee)
11:00 AM-8:30 PM
10:00 AM-7:30 PM
1.1-Assistant Managers
Wood, Chris
上面的輸出是錯誤的。這是CSV文件(有些是,不是所有的)
1.0-Store Manager (1 Employee),,,,,,,,
"Pro, Bob",1.0-Store Manager,47.5,5:30 AM-3:00 PM,5:30 AM-3:00 PM,11:00 AM-8:30 PM,11:00 AM-8:30 PM,9:00 AM-6:30 PM,OFF
1.1-Assistant Managers (3 Employees),,,,,,,,
"Crow, Billy",1.1-Assistant Managers,47.5,10:00 AM-7:30 PM,5:30 AM-3:00 PM,5:30 AM-3:00 PM,5:30 AM-3:00 PM,OFF,11:00 AM-8:30 PM
"Ras, Pat",1.1-Assistant Managers,47.5,5:30 AM-3:00 PM,9:00 AM-6:30 PM,10:00 AM-7:30 PM,,11:00 AM-8:30 PM,9:00 AM-6:30 PM
"Wood, Chris",1.1-Assistant Managers,47.5,,11:00 AM-8:00 PM,8:30 AM-6:30 PM,10:00 AM-7:30 PM,5:30 AM-3:00 PM,5:30 AM-3:00 PM
1.2- Supervisors (7 Employees),,,,,,,,
正如你所看到的,輸出不跳過臨,鮑勃乾脆。然後在顯示Wood之前跳過Crow和Ras。
我也得到
Input past end of file
Thanks idealmachine。這就是訣竅:o) – StealthRT 2010-11-13 22:21:40