by Anonymous (267 Submissions)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 18th December 1998
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Map a network drive
Dim strPassword As String
Dim strNetworkPathName As String
strLocalDriveLetter = "K:" 'Local drive letter to be mapped
strPassword = "" 'specify network password if required
strNetworkPathName = "\\NETWORKPATH\VOL1" 'path to network drive
If WNetAddConnection(strNetworkPathName, strPassword, strLocalDriveLetter) > 0 Then
MsgBox ("An Error occurred mapping the drive")
Else
MsgBox ("Drive successfully mapped!")
End If