12-17-2022, 07:15 PM
I store data in files with similar Names, I just tag on a number at the end to separate them. I then use a routine which will open multiple files. For example,
FileName$ = "DataDAY"
For FNum = 1 To 31
FN$ = Str$(FNum)
Print FileName$ + LTrim$(FN$) ' NOTE: Using "Print" here to show the actual File Name generated
'open FileName$+LTrim$(FN$) as #FNum
Next FNum
Sleep
I get DataDay1, DataDay2, DataDay3 ...DataDay31
However using FreeFile like this'
For FNum = 1 To 31
FN = FreeFile
FN$ = Str$(FN) 'Str$(FNum)???
Print FileName$ + LTrim$(FN$)
'open FileName$+LTrim$(FN$) as ???
Next FNum
I get DataDay1, DataDay1, DataDay1...DataDay1
To open multiple files with FreeFile, I tried this method
Day1 = FreeFile
Day1$ = Str$(Day1)
Print FileName$ + LTrim$(Day1$)
DataDay2 = FreeFile
Day2$ = Str$(Day2)
Print FileName$ + LTrim$(Day2$)
DataDay3 = FreeFile
Day3$ = Str$(Day3)
Print FileName$ + LTrim$(Day3$)
This gives me DataDay1, DataDay0, DataDay0
Opening multiple files using FreeFile is alluding me.
FileName$ = "DataDAY"
For FNum = 1 To 31
FN$ = Str$(FNum)
Print FileName$ + LTrim$(FN$) ' NOTE: Using "Print" here to show the actual File Name generated
'open FileName$+LTrim$(FN$) as #FNum
Next FNum
Sleep
I get DataDay1, DataDay2, DataDay3 ...DataDay31
However using FreeFile like this'
For FNum = 1 To 31
FN = FreeFile
FN$ = Str$(FN) 'Str$(FNum)???
Print FileName$ + LTrim$(FN$)
'open FileName$+LTrim$(FN$) as ???
Next FNum
I get DataDay1, DataDay1, DataDay1...DataDay1
To open multiple files with FreeFile, I tried this method
Day1 = FreeFile
Day1$ = Str$(Day1)
Print FileName$ + LTrim$(Day1$)
DataDay2 = FreeFile
Day2$ = Str$(Day2)
Print FileName$ + LTrim$(Day2$)
DataDay3 = FreeFile
Day3$ = Str$(Day3)
Print FileName$ + LTrim$(Day3$)
This gives me DataDay1, DataDay0, DataDay0
Opening multiple files using FreeFile is alluding me.