Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drive Mapping

Status
Not open for further replies.

JDU

Technical User
Dec 23, 2002
182
US
I am using the following code to map drives upon opening of a form. The mapping works but I also get a blank Msgbox, can anyone explain why and how to solve it. Thanks.

Private Sub Form_Load()
On Error GoTo ErrorHandler


Dim Path1, Path2, Path3, Path4 As String

Path1 = "\\plabbank01\c$\bloodbank"
Path2 = "\\plabbank02\c$\bloodbank"
Path3 = "\\plbcl03\c$\bloodbank"
Path4 = "\\ppalab005\c$\bloodbank"

Call Shell("NET USE M: " & Chr(34) & "" & Path1 & Chr(34) & " XF4-bR7-5B
/USER:wsservice /PERSISTENT:NO")
Call Shell("NET USE N: " & Chr(34) & "" & Path2 & Chr(34) & " XF4-bR7-5B
/USER:wsservice /PERSISTENT:NO")
Call Shell("NET USE O: " & Chr(34) & "" & Path3 & Chr(34) & " XF4-bR7-5B
/USER:wsservice /PERSISTENT:NO")
Call Shell("NET USE P: " & Chr(34) & "" & Path4 & Chr(34) & " XF4-bR7-5B
/USER:wsservice /PERSISTENT:NO")

ErrorHandler:
MsgBox Err.Description
Exit Sub

End Sub
 
Put an Exit Sub instruction before the ErrorHandler label.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top