VBA DIR() Locks Directory

MrSockpuppet

New member
Local time
Today, 07:52
Joined
Oct 4, 2007
Messages
2
Hello,

If I run this code:

Code:
Public Function Check_Directory(DirName As String) As Boolean
    Check_Directory = False
    
    If Dir(DirName) <> "" Then
        Check_Directory = True
    End If
    
End Function

Then it locks the directory (one listed as DirName) so that I cannot rename it and trying to enter it crashes explorer.

Any ideas?

Do I have to kill Dir or set it to nothing?

Cheers in advance
Richard
 

Users who are viewing this thread

Back
Top Bottom