Adding files to an array using Dir
Dir doesn't return an array. See the help example for Dir to see how to use
it.
Perhaps you want to use FileFind or the filesystemobject in the scripting
runtime library.
--
Regards,
Tom Ogilvy
"Jeff" wrote in message
...
The code below is used to select files which will then be zipped up and
saved
to a location. I am trying to automate the process completly to avoid the
users missing files in their selection process.
Since I know that the files I want are excel, I thought I could use the
Dir
command to return a list of the files just like i get inthe immediate
window.
Any ideas or direction?
FileNameXls = Dir("\\CCT75-F3-FIL03\GLOBALSHARE01\PMD PMO\F05
Files\Monthly-Project LE\02+10 Post Act Projects\Project over
$1MM\CIS\*.xls")
'Application.GetOpenFilename(filefilter:="Excel Files, *.xls", _
MultiSelect:=True)
If IsArray(FileNameXls) = False Then
'do nothing
Else
NameList = ""
For iCtr = LBound(FileNameXls) To UBound(FileNameXls)
NameList = NameList & " " & Chr(34) & FileNameXls(iCtr) & Chr(34)
vArr = Split97(FileNameXls(iCtr), "\")
sFileNameXls = vArr(UBound(vArr))
If bIsBookOpen(sFileNameXls) Then
MsgBox "You can't zip a file that is open!" & vbLf & _
"Please close: " & FileNameXls(iCtr)
Exit Sub
End If
Next iCtr
|