Thread: DIR and Arrays
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nigel Nigel is offline
external usenet poster
 
Posts: 923
Default DIR and Arrays

Thanks to all for your valued suggestions. I now have a way forward

--
Cheers
Nigel



"Helmut Weber" wrote in message
...
Hi Nigel,

use a collection instead of an array,
so you don't have to worry about re-dimension.

Sub Test4()
Dim oCll As Collection
Set oCll = New Collection
Dim myfiles As String

myfiles = Dir("C:\test\excel\*.xls")
Do While myfiles < ""
oCll.Add myfiles
myfiles = Dir
Loop
MsgBox oCll(1)
MsgBox oCll(oCll.Count)
End Sub

And have a look at the quotation marks in your sample.
There is one too many.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"