title: VBA MapNetworkDrive to server with windows credentials
body: <p>I'm using windows 7 and Access 2010. I'm trying to connect to our server to see files.
  My problem is that I don't want to have the username or password in the code. I would like to have windows to prompt for it if authentication needed (from my tests, once you authenticate you don't have to re-do it for a while).
  From <a href="http://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx" rel="nofollow noreferrer" title="MatNetworkDrive Object MDSN">MapNetworkDrive Object MSDN</a>, strUser and strPassword is optional and uses current users credentials, but this doesn't seem to work for a server.</p>
  <pre><code>Dim objFSO As Object
  Dim objFolder As Object
  Dim objNetwork As Object
  Dim strShareLetter As String
  Dim strURL As String, strUser as String, strPassword as String
  strShareLetter = &quot;L:&quot;
  
  
  Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
  strURL = &quot;\\company@SSL\DavWWWRoot\companydav\nodes\12345678\&quot;
  
  Set objNetwork = CreateObject(&quot;WScript.Network&quot;)
  objNetwork.MapNetworkDrive strShareLetter, strURL, False, strUser, strPassword
  
  Set objFolder = objFSO.GetFolder(strURL)
  
  MsgBox objFolder.Files.Count
  MsgBox objFolder.SubFolders.Count
  
  Set objFolder = Nothing
  Set objFSO = Nothing
  
  objNetwork.RemoveNetworkDrive (strShareLetter)
  Set objNetwork = Nothing
  </code></pre>
  <p>If I write my user/password in the code everything works. But I need other users to be able to use it and I don't want my credentials being used everywhere. I would like a windows credentials prompt or something along that way. I don't want to prompt for the user password via vba for security reasons.</p>
  <p>Any ideas? I searched google for solutions but I can't seem to find one. thank you</p>