This code is in the Form_Load event. On Form Load, File1.FileName will be null. (Assuming that File1 is a FileListBox)
You either need to select the Customer'th item before trying to open it in order to set the value of the Filename property.
This will highlight the file being processed in the FileListBox as it goes through each oneCode:File1.Selected(Customer) = True
or use:
instead, which will not highlight anything in the FileListBox. I think I'd also set the FileListBox's Enabled property to False so the user is aware that the process is 'automatic' and can't click on an entry, which might mess your loop up if you use the first option above.Code:Open (File1.Path & "\" & File1.List(Customer)) For Input As #1
BTW It's good practice to use FreeFile to get a File Number rather than assume #1 is available.
Code:Din InfFile as Integer intFile = FreeFile Open .....etc..... As Intfile. . . etc . Input #intFile ,CusData(i)




Reply With Quote
