R
redtux
Hi I have the following code in a vba module
Dim Mydir As String
Dim Mydir1 As String
Dim Myname As String
'Debug.Print path
Mydir = Dir(path, vbDirectory)
Do While Mydir <> "" ' Start the loop.
If Mydir <> "." And Mydir <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(path & Mydir) And vbDirectory) = vbDirectory Then
If Left(Mydir, 3) = "200" Then
Debug.Print Mydir ' Display entry only if it
Mydir1 = path & Mydir & "\"
Myname = Dir(Mydir1) ' if this is commented out the loop runs
but not otherwise
End If
End If ' it represents a directory.
End If
Mydir = Dir ' Get next entry.
Loop
The idea is to loop through sub-dirs and then to get file name in each
sub-dir, however the loop fails as above
any ideas
Dim Mydir As String
Dim Mydir1 As String
Dim Myname As String
'Debug.Print path
Mydir = Dir(path, vbDirectory)
Do While Mydir <> "" ' Start the loop.
If Mydir <> "." And Mydir <> ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(path & Mydir) And vbDirectory) = vbDirectory Then
If Left(Mydir, 3) = "200" Then
Debug.Print Mydir ' Display entry only if it
Mydir1 = path & Mydir & "\"
Myname = Dir(Mydir1) ' if this is commented out the loop runs
but not otherwise
End If
End If ' it represents a directory.
End If
Mydir = Dir ' Get next entry.
Loop
The idea is to loop through sub-dirs and then to get file name in each
sub-dir, however the loop fails as above
any ideas