Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
dir
I have specified a directory path and a variable is populated for the first file. When I try to get the next file in the directory by useing a = Dir a is populated with "". This would indicate that all files have been seen but there are 8 more files in the directory that have not been touched. Why would dir give a ""
seeker53 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
dir
Using a = Dir a asks for a second file with the same name. For
subsequent files, use a = Dir. In article , "seeker53" wrote: I have specified a directory path and a variable is populated for the first file. When I try to get the next file in the directory by useing a = Dir a is populated with "". This would indicate that all files have been seen but there are 8 more files in the directory that have not been touched. Why would dir give a ""? seeker53 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
dir
Yes I would agree but when I use a = Dir then a is populated with ""
seeker53 JE McGimpsey wrote in message ... Using a = Dir a asks for a second file with the same name. For subsequent files, use a = Dir. In article , "seeker53" wrote: I have specified a directory path and a variable is populated for the first file. When I try to get the next file in the directory by useing a = Dir a is populated with "". This would indicate that all files have been seen but there are 8 more files in the directory that have not been touched. Why would dir give a ""? seeker53 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
dir
This kind of thing works ok for me:
Option Explicit Sub testme01() Application.ScreenUpdating = False Dim myFiles() As String Dim fCtr As Long Dim myFile As String Dim myPath As String 'change to point at the folder to check myPath = "c:\my documents\excel\test" If Right(myPath, 1) < "\" Then myPath = myPath & "\" End If myFile = Dir(myPath & "*.xls") If myFile = "" Then MsgBox "no files found" Exit Sub End If 'get the list of files fCtr = 0 Do While myFile < "" fCtr = fCtr + 1 ReDim Preserve myFiles(1 To fCtr) myFiles(fCtr) = myFile myFile = Dir() Loop If fCtr 0 Then For fCtr = LBound(myFiles) To UBound(myFiles) 'do something with mypath & myfiles(fctr) Next fCtr End If Application.ScreenUpdating = True End Sub seeker52 wrote: Yes I would agree but when I use a = Dir then a is populated with "" seeker53 JE McGimpsey wrote in message ... Using a = Dir a asks for a second file with the same name. For subsequent files, use a = Dir. In article , "seeker53" wrote: I have specified a directory path and a variable is populated for the first file. When I try to get the next file in the directory by useing a = Dir a is populated with "". This would indicate that all files have been seen but there are 8 more files in the directory that have not been touched. Why would dir give a ""? seeker53 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|