I am using Excel 2007, I have the code below it tries to run and when it gets 513 files it gives me the error message "runtime error 52 bad file name or number"
What i have is I select txt files then open each one put those into an array. Then i have some other code that goes to each array(file) and checks for some information that i am interested in.
When i went to debug it took me to Open mFleNm For Input As #file, I put the mouse over the mFleNm and the path looks correct and the file was 513. I had selectd 945 files.
Any ideas what is causing this to stop and give the error mentioned above.
Your help is appreciated.
Thanks
Moderator's Note: Welcome to the forum. Codes should be enclosed with code tags. Select the code then hit the "#" sign. I'll do it for you now. Thanks.
What i have is I select txt files then open each one put those into an array. Then i have some other code that goes to each array(file) and checks for some information that i am interested in.
When i went to debug it took me to Open mFleNm For Input As #file, I put the mouse over the mFleNm and the path looks correct and the file was 513. I had selectd 945 files.
Code:
file = FreeFile
'Open each selected CTX File and process
For file = 1 To fileCnt
mFleNm = returnArray(file)
ReDim Preserve datafile(0) As String
intCount = 0
Open mFleNm For Input As #file ' Open file.
'Reinitialize variables
UseLinkObjects = False
NavScreens = ""
ObjectName = ""
While Not EOF(file)
ReDim Preserve datafile(intCount) As String
ReDim Preserve dataStr(file) As String
Line Input #file, textline ' Read line into variable.
''************************* This where i thought i could dump the each line into an array *******************************************************
datafile(intCount) = textline
'*********************************************************************************************************
Wend
Close #file ' Close file.
Next file
Your help is appreciated.
Thanks
Moderator's Note: Welcome to the forum. Codes should be enclosed with code tags. Select the code then hit the "#" sign. I'll do it for you now. Thanks.