troubleshooting Question

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

Avatar of shieldsco
shieldscoFlag for United States of America asked on
Microsoft SharePointVBA
1 Comment1 Solution6 ViewsLast Modified:
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 = ""
 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

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros