Connect Method

Microsoft Word Visual Basic

Connect Method

       

Establishes a connection to a network drive.

expression.Connect(Path, Drive, Password)

expression   Required. An expression that returns a System object.

Path   Required String. The path for the network drive (for example, "\\Project\Info").

Drive   Optional Variant. A number corresponding to the letter you want to assign to the network drive, where 0 (zero) corresponds to the first available drive letter, 1 corresponds to the second available drive letter, and so on. If this argument is omitted, the next available letter is used.

Password   Optional Variant. The password, if the network drive is protected with a password.

Remarks

Use the Dialogs property with the wdDialogConnect constant to display the Connect To Network Drive dialog box. The following example displays the Connect To Network Drive dialog box, with a preset path shown.

With Dialogs(wdDialogConnect)
    .Path = "\\Marketing\Public"
    .Show
End With

Example

This example establishes a connection to a network drive (\\Project\Info) protected with the password "smiley" and assigns the network drive to the next available drive letter.

System.Connect Path:="\\Project\Info", Password:="smiley"

This example establishes a connection to a network drive (\\Team1\Public) and assigns the network drive to the third available drive letter.

System.Connect Path:="\\Team1\Public", Drive:=2