VB Code:
Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszstrPassword As String, ByVal lpszLocalName As String) As Long Dim strLocalDriveLetter As String Dim strPassword As String Dim strNetworkPathName As String strLocalDriveLetter = "Z:" 'Local drive letter to be mapped strPassword = "" 'specify network password if required strNetworkPathName = "\\NEWPATH\NEWPATH" '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




Reply With Quote