title: excel vba to upload file to sharepoint
body: <p>I am trying to upload a folder from my C drive to a SharePoint library site. I have used the below code, which works fine when the ToPath is not a SharePoint library site but another folder from my C drive. Where am I going wrong?</p>
  
  <pre><code>Sub AddSharePointFiles()
  
  Dim FSO As Object
  Dim FromPath As String
  Dim ToPath As String
  
  ToPath = "https://share.name.com/site/folder/_layouts/15/start.aspx#/LibraryName/Forms/AllItems.aspx"
  FromPath = "C:\Users\Name\Documents\FolderName"
  
  Set FSO = CreateObject("scripting.filesystemobject")
  
  FSO.CopyFile Source:=FromPath, Destination:=ToPath
  
  End Sub
  </code></pre>
  
  <p>Thank you!</p>