When opening a file, there s no password setting. However, when mapping a drive you can do:

Map:
VB Code:
  1. Private Declare Function WNetAddConnection Lib "mpr.dll" Alias "WNetAddConnectionA" (ByVal lpszNetPath As String, ByVal lpszPassword As String, ByVal lpszLocalName As String) As Long
  2.  
  3. Private Sub Form_Load()
  4. WNetAddConnection "\\vdk00005\proj", "", "H:"
  5. End Sub
UnMap:
VB Code:
  1. Private Declare Function WNetCancelConnection Lib "mpr.dll" Alias "WNetCancelConnectionA" (ByVal lpszName As String, ByVal bForce As Long) As Long
  2. Private DisconnectIt As Long
  3.  
  4. 'Where H: is the drive letter you wish to dis-connect
  5. 'The second parameter of this API determines whether to disconnect
  6. ‘ the drive if there are files open on it.  
  7. ‘ If it is passed FALSE, the disconnect will fail if there are open files
  8. 'If it is passed TRUE, the disconnect will occur no matter
  9. ‘   what is open on the drive
  10. DisconnectIt = WNetCancelConnection("H:", True)