RmDir function doesn't work in LOOP! [simple help]
why doesn't this work?
Code:
Private Sub Command1_Click()
Dim a
Dim b
b = InputBox("Enter your name")
For i = 1 To 50
a = "c:/windows/desktop/" & b & i
MkDir a
Next i
End Sub
Private Sub Command2_Click()
Dim a, b
b = InputBox("Enter ur name")
For i = 1 To 50
a = "c:/windows/desktop/" & b & 1 & "/"
RmDir a
Next i
End Sub
Re: RmDir function doesn't work in LOOP! [simple help]
Thats Easy!
Look at your code:
VB Code:
For i = 1 To 50
a = "c:/windows/desktop/" & b & [B]1[/B] & "/"
RmDir a
Next i
can't delete same folder twice!
sould be:
VB Code:
For i = 1 To 50
a = "c:/windows/desktop/" & b & [B]i[/B] & "/"
RmDir a
Next i
Cheers! :bigyello:
Re: RmDir function doesn't work in LOOP! [simple help]
Also, you have to check if folder exist and/or if it contains files/subfolders prior to deleting it or RmDir will fail.