Copy a file on Sharepoint with VBA

Copper Contributor

Hello,

I have coded a macro which creates a new document by filling a form. To create it, I copy/paste a template. It works fine on my local files but I am now trying to update it to work if the file is on sharepoint web (I do not have the sharepoint in local on my computer).
I believe the problem comes from using a URL.

This is my original code :

 

'Chemin du fichier
Dim MonDossier As String
MonDossier = ThisWorkbook.Path & "\"

'Créer le fichier de suivi en fonction des données entrées
'Copier le fichier original sans macro dans le même dossier

Dim FichierOriginal As String
Dim FichierCopie As String

FichierOriginal = "__template_suivi_pour_la_copie.xlsx"
FichierCopie = MonDossier & Reglementations.Entreprise_textbox.Value & "_" & Reglementations.Site_textbox.Value & "_suivi_onboarding.xlsx"

FileCopy FichierOriginal, FichierCopie

 

I have already tried changing the URL according to what I found on another forum : getting rid of the "https:", changing all / into \ and adding "@SSL" after the domain, but to no avail.

I also saw another solution using Sharepoint objects but I do not have that library and wasn't able to find a way to add these objects so couldn't test it.

 

Any ideas?

 

Thanks

0 Replies