Avatar of shieldsco
Flag for United States of America

asked on 

Copy files from a Folder to a SharePoint Folder using Access vba

I trying to use the below code to copy files from my local drive using Access VBA however receiving an error Invalid Outside Procedure in the FromPath

Option Compare Database
Option Explicit
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
 FromPath = "C:\Ryan\MultipleFilesFrom" '<< Change
 ToPath = "https://collaboration.net/sites/Shared%20Documents/"
 If Right(FromPath, 1) = "\" Then
 FromPath = Left(FromPath, Len(FromPath) - 1)
 End If
 If Right(ToPath, 1) = "/" Then
 ToPath = Left(ToPath, Len(ToPath) - 1)
 End If
 Set FSO = CreateObject("scripting.filesystemobject")
 If FSO.FolderExists(FromPath) = False Then
 MsgBox FromPath & " doesn't exist"
 Exit Sub
 End If
 FSO.CopyFolder Source:=FromPath, Destination:=ToPath
 MsgBox "You can find the files and subfolders from " & FromPath & " in " & ToPath
 End Sub

Open in new window

Microsoft SharePointVBA

Avatar of undefined
Last Comment

8/22/2022 - Mon