Partager via


System.Connect Method

Establishes a connection to a network drive.

Namespace:  Microsoft.Office.Interop.Word
Assembly:  Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)

Syntax

'Declaration
Sub Connect ( _
    Path As String, _
    ByRef Drive As Object, _
    ByRef Password As Object _
)
'Usage
Dim instance As System
Dim Path As String
Dim Drive As Object
Dim Password As Object

instance.Connect(Path, Drive, Password)
void Connect(
    string Path,
    ref Object Drive,
    ref Object Password
)

Parameters

  • Path
    Type: System.String
    Required String. The path for the network drive (for example, "\\Project\Info").
  • Drive
    Type: System.Object%
    Optional Object. 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
    Type: System.Object%
    Optional Object. The password, if the network drive is protected with a password.

Remarks

Security   Avoid using hard-coded passwords in your applications. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code.

Use the Dialogs property with the wdDialogConnect constant to display the Connect To Network Drive dialog box.

See Also

Reference

System Interface

System Members

Microsoft.Office.Interop.Word Namespace