Troubleshooting
Problem
The script below will map a network drive.
Resolving The Problem
In order to execute below script You will need to know two things:
1. What the next drive letter map will be (drive_letter = "S")
2. The actual UNC path to the drive and folder ("\\Servername\Folder")
Requirements:
Internet Explorer 4.0 or greater, latest Microsoft Windows Service Packs and/or updates depending on Windows platform being used.
>>>>>>>>>>>>>>>>>>>>>
Option Explicit
Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
Sub Main
Dim drive_letter As String
Dim share_name As String
Dim password As String
drive_letter = "S"
If InStr(drive_letter, ":") = 0 Then
drive_letter = drive_letter & ":"
share_name = \\ServerName\FolderName
password = "password"
If WNetAddConnection(share_name, password, drive_letter) > 0 Then
MsgBox "Error mapping drive"
Else
MsgBox "Drive successfully mapped"
End If
End If
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Was this topic helpful?
Document Information
More support for:
Rational Robot
Software version:
2001a, 2001a.04.00, 2002, 2002.05.00, 2002 Release 2, 2002.05.20, 2003, 2003.06.00, 2003.06.12, 2003.06.13
Operating system(s):
Windows
Document number:
81583
Modified date:
16 June 2018
UID
swg21194551