|
-
Oct 14th, 2001, 10:09 AM
#1
Thread Starter
Frenzied Member
How do I...
Is this possible...
I need to open several files as binary, the names of which are defined by the user at runtime and placed in a listbox. Can this be done??? How???
Thanks in advance for any help!
~Squirrelly1
-
Oct 14th, 2001, 10:20 AM
#2
Sure it can be done, try something like this.
Code:
'Opens all the files at the same time
for i=0 to me.listbox1.listcount-1
Open me.listbox1.list(i) for binary as #1
'Do something to the file
Close #1
next i
-
Oct 14th, 2001, 10:25 AM
#3
Code:
dim File() as integer
sub Openlist()
On Erroro Goto Bottom
for =i 0 to List1.ListCount - 1
redim preserve File(i+1)
File(i+1 ) = i+1
open list1.list(i) for binary access read as File(i+1)
next
Exit Sub
Bottom:
msgbox "Error opening " & list1.List(i),vbOkonly
There is a limit to the total number of files open at one time.
-
Oct 14th, 2001, 10:50 AM
#4
Thread Starter
Frenzied Member
-
Oct 14th, 2001, 10:55 AM
#5
How do get intFreeFile, and what is the value of me.list1.list(0). Try this:
Code:
For i = 0 To Me.List1.ListCount
debug.print me.list1.list(i)
Open Me.List1.List(i) For Binary Access Read Write Lock Write As intFreeFile
ReDim bytAll(LOF(intFreeFile) - 1)
Get intFreeFile, , bytAll
Close intFreeFile
Next i
-
Oct 14th, 2001, 11:13 AM
#6
Thread Starter
Frenzied Member
Thank you
AIS_DK,
Thanx for mentioning the FileNumber!!! After reading your reply I got to thinking and I realized that I accidentally deleted my:
Code:
intFreeFile = FreeFile
which made a world of difference!
THanx again,
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|