Find letter assigned to main drive
<p>I'm trying to find a function like <code>Environ</code> to find what drive the main drive in my business has been mapped to on a particular PC.</p>

<p>Using the filepath "G:\Eworking\SET\Operations\file" I know that my PC has been mapped so that that filepath is within G drive but others may be mapped differently so I'd like to determine which it is.</p>

<p>I've tried the if else method of going through the alphabet and doing a <code>if Dir([filepath]) then</code> before (see below) but I was wondering if there's a better way of doing this?</p>

<pre><code>Sub LoopThroughDrives()
sFilePath As String

sFilePath = ":\Eworking\SET\Operations\file"

If Dir("A" &amp; sFilePath) &gt; 0 Then
    msgbox ("It's in drive A")
    Else
        If Dir("B" &amp; sFilePath) &gt; 0 Then
            msgbox ("It's in drive B")
            Else
                If Dir("C" &amp; sFilePath) &gt; 0 Then
                    msgbox ("It's in drive C")
                    Else
                        '...........................
                        'All other letters of the alphabet, checking each possibility
                        '...........................
                End If
        End If
End If

End Sub
</code></pre>