Thread: Excel DIR
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Excel DIR

Your code works fine for me in Excel97. What specific problem are
you encountering?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Nigel" wrote in message
...
Hi All
I am using the DIR function in VBA (Excel 2002) to build a
list of files in
a specified directory as follows, and it work fine. My problem
is that I
need a similar code for Excel 97. It appears the the construct
for the DIR
function does not accept the pathname and or attributes
parameters in the
smae way. Can anyone help to describe the differences between
them.

Directory = "C:\myfiles\"
xFile = Dir(Directory & "*.xls", 7)
Do While xFile < ""
wpList.Cells(xRow, 1) = xFile
xRow = xRow + 1
xFile = Dir
Loop

--
Cheers
Nigel