M
Matt
I set up three dummy folders in my c: drive
with path "Test\2008\April". Unfortunately when I run this CODE in a
module
I always get an error message. i tried putting the strSub2 code in a
seperate sub routine but same error.
I'm wondering if the problem has something to do with what path stored
in
the Dir after the inner loop.
Any help on this problem is appreciated. Thanks.
CODE:
=========================================
Sub getFile()
strSub1 = Dir$("C:\Test\", vbDirectory)
Do While Len(strSub1) <> 0
If Not ((strSub1 = ".") Or (strSub1 = "..")) Then
If InStr(1, strSub1, "2008") Then
strSub2 = Dir$("C:\Test\2008\", vbDirectory)
Do While Len(strSub2) <> 0
If Not ((strSub2 = ".") Or (strSub2 = "..")) Then
If InStr(1, strSub2, "April") Then
MsgBox strSub2
End If
End If
strSub2 = Dir$()
Loop
End If
End If
strSub1 = Dir$()
Loop
- ==================================
INFO NOT RELATED TO ISSUE, BUT MAYBE SOLUTION
In the production version "2008" and "April" are incremented variables
(its pretty easy to
just have "C:\Test\" & Month(i) type of thing)
- ==================================
End Sub
with path "Test\2008\April". Unfortunately when I run this CODE in a
module
I always get an error message. i tried putting the strSub2 code in a
seperate sub routine but same error.
I'm wondering if the problem has something to do with what path stored
in
the Dir after the inner loop.
Any help on this problem is appreciated. Thanks.
CODE:
=========================================
Sub getFile()
strSub1 = Dir$("C:\Test\", vbDirectory)
Do While Len(strSub1) <> 0
If Not ((strSub1 = ".") Or (strSub1 = "..")) Then
If InStr(1, strSub1, "2008") Then
strSub2 = Dir$("C:\Test\2008\", vbDirectory)
Do While Len(strSub2) <> 0
If Not ((strSub2 = ".") Or (strSub2 = "..")) Then
If InStr(1, strSub2, "April") Then
MsgBox strSub2
End If
End If
strSub2 = Dir$()
Loop
End If
End If
strSub1 = Dir$()
Loop
- ==================================
INFO NOT RELATED TO ISSUE, BUT MAYBE SOLUTION
In the production version "2008" and "April" are incremented variables
(its pretty easy to
just have "C:\Test\" & Month(i) type of thing)
- ==================================
End Sub