1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Public Function GetRootFolderAmovibleDrive(ByVal sNomVolume As String) As String
On Error GoTo fin
Dim oSFS,oSD As Scripting.Drive
'Set oSFS = New Scripting.FileSystemObject 'est identique à la ligne suivante
Set oSFS=CreateObject("Scripting.FileSystemObject")
For Each oSD In oSFS.Drives
If oSD.DriveType = Removable And oSD.IsReady Then
If oSD.VolumeName = sNomVolume Then
GetRootFolderAmovibleDrive = oSD.RootFolder
Exit For
End If
End If
Next oSD
fin:
Set oSD = Nothing
Set oSFS = Nothing
Exit Function
End Function |
Partager