Hi,
I have successfully used the DriveLetter property to get a list of the local
drives:
Dim fs, d, dc
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
If d.DriveType = 2 Then
k = k + 1
strLocalDrive(k) = d.driveletter & ":\"
End If
Next
It works great!
Then I needed to know if a network share was associated with the right
letter. I used vb help and found the following sub:
Sub ShowDriveLetter(drvpath)
Dim fs, d, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(drvpath))
s = "Drive " & d.driveletter & ": - "
s = s & d.VolumeName & vbCrLf
s = s & "Free Space: " & FormatNumber(d.FreeSpace / 1024, 0)
s = s & " Kbytes"
MsgBox s
Debug.Print d.driveletter
End Sub
I used it in my code as follow:
Dim fs, d, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName("\\smb\Uhome"))
s = d.driveletter
s does not return "N" as it should, but returns an empty string. Why?
Thanks for your help in advance.