Hey,
Thanks a lot for your time. I am trying to count how many doc files whose files name contains My document.
two errors:
1 it does not go through all the doc files. Those are not hidden.
2 when loop to last file, it does not continue to loop to "". It just stuck in last file. so that loop never ends...
please help me. here is the code i have.
Sub file()
Dim a As String
Dim i As Integer
a = "C:\Documents and Settings\Administrator\My Documents\Downloads\*.doc"
b = Dir$(a)
Do While b <> " "
If b Like "*My document*" Then
i = i + 1
End If
b = Dir$()
Loop
End Sub
Thanks a lot for your time. I am trying to count how many doc files whose files name contains My document.
two errors:
1 it does not go through all the doc files. Those are not hidden.
2 when loop to last file, it does not continue to loop to "". It just stuck in last file. so that loop never ends...
please help me. here is the code i have.
Sub file()
Dim a As String
Dim i As Integer
a = "C:\Documents and Settings\Administrator\My Documents\Downloads\*.doc"
b = Dir$(a)
Do While b <> " "
If b Like "*My document*" Then
i = i + 1
End If
b = Dir$()
Loop
End Sub