title: How to save file to shared drive on network with VBA
body: <p>Using trying to write code that will save a file to a shared drive on our network.  If I use a mapped drive as the destination location (i.e. R:...) then it works with no problem.  BUT, not everyone is mapped to that, so I want to be able to save the file use \ourserver\serverfolder ... </p>
  
  <p>when I try to replace "R:\" &amp; filename with "\ourserver\serverfolder\" &amp; file name, I get an error 76, "File Path Not Found."</p>
  
  <p>In essence, the question is how do I save a file to a shared drive, using the shared drive path, via vba?</p>
  
  <p>the sample code takes sourcefile "C:\houses\myhouse.pdf" ... and wants to save to destination file "\ourserver\serverfolder\anotherfolder\myhouse.pdf"</p>
  
  <pre><code>Private Sub CopyRenameFile(ByRef SourceFile As String, ByRef DestinationFile As String)
  On Error Resume Next
      FileCopy SourceFile, DestinationFile
          If Err.Number &lt;&gt; 0 Then
              Call LogError(Err.Number, Err.Description, "CopyRenameFile() Class FileMoverMove", , True)
              MsgBox "Copy error: " &amp; SourceFile
          End If
  On Error GoTo 0
  </code></pre>
  
  <p>End Sub</p>