Loop a File1.listbox?

coder2002
07-30-2002, 11:55 PM
How could I Loop a File1 listbox
and copy to another directory
I have a Dir1.listbox and File1.listbox and need to
do a loop. I noted that It uses Index, or had error
What loop would work - with Index 0 to what ever
the file1.listcount or something like that, so I can copy
all in the file1.filenames without incountering an error?
Thanks
:)

Spirit
07-31-2002, 12:10 AM
I am not quite sure what you want, but i think you want all the names in the file-listbox.

This should work:

Option Explicit

Dim FileNames as String
Dim n as Long

For n = 0 To File1.ListCount

FileNames = FileNames & "," & File1.List(n)

Next


This code takes all the names out of the file-listbox and puts it in the variable "FileNames". They are then seperated by a comma.

I did not test it, but it should work.

Greets
Ben

coder2002
07-31-2002, 12:16 AM
This way works, But how could I copy to a different location
Say c:\windows\temp - c:\temp
in the loop?. using the file1.list

Flyguy
07-31-2002, 01:21 AM
Look up the FileCopy command.

coder2002
07-31-2002, 03:46 AM
! ArnoutV !
I have the filecopy command, this search came back
with ect of the code I already have.
But this site did nt have any that I need to use
with the loop type of copy to copy all the files in the File1.listbox!

(You said)
Look up the FileCopy command.




And I did a search here elsewhere before I posted here.
Got to go do research in google search engine.
perhaps another forum.

Flyguy
07-31-2002, 06:00 AM
I meant, just look up the FileCopy command in the help ;)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum