CodeItBetter Programming Another VB Programming Blog

How to check whether given Drive exists

Posted on August 17, 2011
1
2
3
4
5
6
7
8
9
10
11
'File/Folder Handling - How to check whether given Drive exists
Public Function DriveExistsUsingFSO(Optional ByVal sDriveName As String = "C") As Boolean
    'Set a reference to "Microsoft Scripting Runtime"
    Dim FSO As Scripting.FileSystemObject
    Set FSO = New Scripting.FileSystemObject
    DriveExistsUsingFSO = FSO.DriveExists(sDriveName)
    Set FSO = Nothing
End Function
 
'How can I call this function:
'Debug.Print DriveExistsUsingFSO("D")
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.