Hmm,
So you literally get the messages "C:\" or "D:\" or "E:\"
from the Message Box?
Hmm, Frustrating.
Think you code Post your Project?
Attach it as a Zip File?
-Lou
Printable View
Hmm,
So you literally get the messages "C:\" or "D:\" or "E:\"
from the Message Box?
Hmm, Frustrating.
Think you code Post your Project?
Attach it as a Zip File?
-Lou
yes that what i get back from the MsgBox , ignore my last post about it scans all the drive's , it just scans C , i was wrong there , sorry .
Code:Private Sub Command1_Click()
Dim Find_What As String
Dim Start_Where As String
Dim SKIP_THIS As String
SKIP_THIS = ":\RECYCLED" '''Your Recycle bin
Find_What = "*.mp3" '''What you want to find
Start_Where = Start '''Your initial directory
MsgBox Drive1.Drive
List1.Clear
Call FIND_IT(Start_Where, Find_What, SKIP_THIS)
End Sub
Private Sub FIND_IT(ByVal M_Where As String, ByVal M_What As String, ByVal Skip_What As String)
Dim MY_DIRS() As String
Dim Start As String
Start = Left(Drive1.Drive, 1) & ":\"
Dim MY_COUNT As Integer '
MY_COUNT = 0
ReDim MY_DIRS(1)
If Right(M_Where, 1) <> "\" Then
M_Where = M_Where & "\"
End If
doiexist = Dir(M_Where & "*.*", vbDirectory)
While doiexist <> ""
If doiexist <> "." And doiexist <> ".." Then
If (GetAttr(M_Where & doiexist) And vbDirectory) = vbDirectory Then
MY_COUNT = MY_COUNT + 1
ReDim Preserve MY_DIRS(MY_COUNT)
MY_DIRS(MY_COUNT) = M_Where & doiexist
Form1.Caption = MY_COUNT
DoEvents
End If
End If
doiexist = Dir
Wend
If Left(M_Where, Len(Skip_What) + 1) <> Skip_What & "\" Then
doiexist = Dir(M_Where & M_What, vbNormal)
While doiexist <> ""
List1.AddItem M_Where & doiexist
doiexist = Dir
Wend
End If
For Each Thing In MY_DIRS
If Thing <> "" Then
Call FIND_IT(Thing, M_What, Skip_What)
End If
Next Thing
End Sub
crap , the minute i posted it i saw it , u guys see it too ?
i entered the
Dim Start As String
Start = Left(Drive1.Drive, 1) & ":\"
in the wrong place , it has to go under the command button.
thats a mistake i won't make again
it works now , thx guys , i learned a lot :)
on more thing , how about a msgbox if no file is found ?
i would need a If , Then for that huh
Change the Above to this:Quote:
Originally posted by Dutch
Code:Private Sub Command1_Click()
Dim Find_What As String
Dim Start_Where As String
Dim SKIP_THIS As String
SKIP_THIS = ":\RECYCLED" '''Your Recycle bin
Find_What = "*.mp3" '''What you want to find
Start_Where = Start '''Your initial directory
MsgBox Drive1.Drive
List1.Clear
Call FIND_IT(Start_Where, Find_What, SKIP_THIS)
End Sub
VB Code:
Private Sub Command1_Click() Dim Find_What As String Dim Start_Where As String Dim SKIP_THIS As String dim start as string SKIP_THIS = ":\RECYCLED" '''Your Recycle bin Find_What = "*.mp3" '''What you want to find start = left(drive1.drive, 1) & ":\" Start_Where = start MsgBox Drive1.Drive List1.Clear Call FIND_IT(Start_Where, Find_What, SKIP_THIS) End Sub
Next, get rid of:
VB Code:
Dim Start As String Start = Left(Drive1.Drive, 1) & ":\"
out of the FIND_IT sub. {Comment it out, delete it, whatever}
Try it and tell us what happens.
{You've altered SKIP_THIS, It won't work. We're going to have
to fix that. Do you have ant recycle bins on anything other than the c drive?}
-Lou
Heh, took longer than expected. Glad you saw it!
Still, SKIP_THIS needs fixing.
-Lou
like i said , it works now :) but thnks for all your work .
could u help me with a MsgBox in case a mp3 isn't found ?
You could try this:
VB Code:
Private Sub Command1_Click() Dim Find_What As String Dim Start_Where As String Dim SKIP_THIS As String dim start as string SKIP_THIS = ":\RECYCLED" '''Your Recycle bin Find_What = "*.mp3" '''What you want to find start = left(drive1.drive, 1) & ":\" Start_Where = start MsgBox Drive1.Drive List1.Clear Call FIND_IT(Start_Where, Find_What, SKIP_THIS) if List1.Listcount = 0 then MsgBox "File(s) Not Found! Try Again Later!" End If ''''OOPS, Forgot this! Just added in an Edit Post! End Sub
It should work, unless Command1_Click ends before FIND_IT finishes.
BUT, if that happens, We can tweek it with an end of sub public
variable.
BTW, Again, the Recycle check won't work, the way you've changed it.
-Lou