Sorry I can't get this to work. It is the loDrives object that appears to have nothing in it. The loDrives.count reports 2 but I have five (assuming that loDrives.count reports the number of drives). But it errors out on loDrives.item.
Below is my test prg. I changed oDrives to loDrives in your example. I'm running XP and VFP7:
myresult=finddrive("\\homesrv\srv-f")
SET STEP ON
return
FUNCTION FindDrive
LPARAMETER tcUNC && The UNC to find
LOCAL lnlast, lni, loNet, loDrives, lcresult, llfound
lcresult = ""
llfound = .F.
SET STEP ON
loNet = CREATEOBJECT("WScript.Network")
loDrives = loNet.EnumNetworkDrives
lnlast = loDrives.Count
lni = -1
DO WHILE lni < lnlast AND NOT llfound
lni = lni + 2
llfound = (UPPER(tcUNC) = UPPER(loDrives.Item(lni)))
ENDDO
IF llfound
lcresult = loDrive.Item(lni - 1)
ENDIF
RETURN lcresult
John Fabiani
Woodland, CA