Filename array

  • Thread starter Thread starter pianoman
  • Start date Start date
P

pianoman

Hi All,
I need to cycle a set of command for each file in a list... the files
do not share folders, or filename structure or anything, so I really
need to hard-code the filenames in, and then define the next name after
each iteration. What's the best way of doing this... presumably define
an array of names and then cycle that?? How do I do that then?! :)

Thanks, as always,

Gareth
 
An added thought.
If the list of files will change, it might be easier to list them on a
worksheet then you can do

Dim v as Variant
with Worksheets("FileList")
set rng = .Range(.Cells(1,1),.Cells(1,1).End(xldown))
End With
v = rng.Value
for i = lbound(v) to ubound(v)
msgbox v(i,1)
Next

note that this is a 2D array with the second dimension 1 to 1.
 
Thanks Tom,
Actually, I already have a list of entries from which I could derive
the filenames, so that may be the easiest thing anyway.

Thanks for the follow-up..
Gareth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top