AnswerBun.com

Unable to upload to SharePoint Online via VBA

SharePoint Asked by Leroy on January 11, 2021

I have tried using the below code to upload a document to SharePoint Online (Sourced from this answer)

Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object

' Where you will enter Sharepoint location path
SharepointAddress = "\sharepoint path to document library"  & "" 

 ' Where you will enter the file path, ex: Excel file
LocalAddress = "H:/test.gif" 

Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(LocalAddress) Then
    FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing

I have signed in to the SharePoint Online site using my work credentials and then navigated to the library and copied the address from the URL bar to paste into the above code, however when I try to run the procedure I am getting an error message saying Run Time Error 76: Path not found

Does anyone know what I am doing wrong? Thanks

One Answer

Try mapping the SharePoint library to a drive letter on your system and see if that works. How to Map SharePoint Document Libraries as Network Drives Also, you can get some great information from VbaA2z videos here VBA and SharePoint.

Answered by Tecrms on January 11, 2021

Add your own answers!

Related Questions

Auto-populate email address from pc:Person?

1  Asked on December 17, 2020 by zeno

   

Org Browser start at a specific user for SP 2013

2  Asked on December 16, 2020 by brandon-black

     

Form based Login Authentication for Public Site Sharepoint online

1  Asked on December 8, 2020 by jitender-singh-tomar

   

Sharepoint PHP File Upload

1  Asked on December 7, 2020 by markvdb

     

CSS Script for Multiple Columns Boxed Style

1  Asked on December 6, 2020 by elebie

 

Faulting application name: csc.exe

2  Asked on December 4, 2020 by emaborsa

         

sharepoint 2013,RSS viewer web part error

1  Asked on December 4, 2020 by pasha

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP