Solved File Copy (1 Viewer)

RevJeff

Registered User.
Local time
Today, 14:39
Joined
Sep 18, 2002
Messages
125
I am trying to copy a file from a SharePoint folder to a local folder on the C:\ and I am getting the following error.

1594311394474.png


Here is my code:

Code:
FileCopy "https://sysco.sharepoint.com/sites/163-FS/Operations/Transportation/RTA/Operations/Transportation/RTA/Routing/Import%20dispacth/Update/Driver%20Notification.accdb", "c:\Driver%20Notification\Driver%20Notification.accdb"

But if I use a windows mapped drive to the same location it works fine:

Code:
FileCopy "r:\RTA\Routing\Import dispacth\Update\Driver Notification.accdb", "c:\Driver Notification\Driver Notification.accdb

Unfortunately not all of the users have the same mapped drive, so I can't use that. I'm sure it is a syntax error with the SharePoint path, but that is the same syntax I use when I import an Excel file, which works fine.

Code:
DoCmd.TransferSpreadsheet acImport, 10, "tblDrivers", "https://sysco.sharepoint.com/sites/163-FS/Operations/Transportation/RTA/Routing/Import%20dispacth/DriverList.xlsx", True, ""

Any help would be greatly appreciated.

Thanks
 

Isaac

Lifelong Learner
Local time
Today, 11:39
Joined
Mar 14, 2017
Messages
8,777
I think you might need to map the sharepoint site to a drive letter before doing the FileCopy. Your code can map and unmap the drive on the fly.
Attached is a sample I recently did. It's in VBScript, but considering you can use late binding in VBA, it might require minimal changes to work in VBA.
 

Attachments

  • sample.txt
    2.3 KB · Views: 201

theDBguy

I’m here to help
Staff member
Local time
Today, 11:39
Joined
Oct 29, 2018
Messages
21,454
Hi. I might try using a HTTPRequest Class to download a local copy of the file.

Sent from phone...
 

Users who are viewing this thread

Top Bottom