X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Vba Copy Command No Longer Works For Sharepoint Upload, Access 2016    
post Aug 15 2019, 10:55 AM

Posts: 882
Joined: 26-March 02
From: St.Louis, MO, USA


We are switching from Win7 to Win 10 at our company. In testing out my access 2016 db VBA I ran across an issue where a copy command used to copy PDF files from \ to network directories and to our company SharePoint site library no longer wants to copy to the SharePoint location, (It still works for network drive copy.).

I will post the code used for the copy command below and if anyone has any thoughts or solutions as to why it will no longer copy to the SharePoint location that would be appreciated. Note it does not give an error. The code just runs but no copy occurs. (I inherited this db and am not much of a VBA programmer so I'm not sure if this is standard or not.)


Option Compare Database
CopyFile "\\namdfs\rel\STL\GROUPS\Cons_Pricing_Execution\RATES\Current_Rates_PDF\Employee.pdf", "\\consumershare.nam.citi.net\sites\RTL_Pricing\Rtl_Rates\DocLib\Employee.pdf"
'...other stuff
End Function

CopyFile Module referenced:
Option Explicit

Declare Function apiCopyFile Lib "kernel32" Alias "CopyFileA" _
(ByVal lpExistingFileName As String, _
ByVal lpNewFileName As String, _
ByVal bFailIfExists As Long) As Long

Public Function CopyFile(SourceFile As String, DestFile As String)

Dim Result As Long
If Dir(SourceFile) = "" Then
MsgBox Chr(34) & SourceFile & Chr(34) & _
" is not valid file name."
Result = apiCopyFile(SourceFile, DestFile, False)

End If
End Function

Go to the top of the page
post Aug 15 2019, 11:50 AM

UtterAccess VIP
Posts: 7,438
Joined: 30-June 11

Try http://www.devhut.net/2010/09/29/ms-access-vba-copy-a-file/ or you could also try using FSO.

Daniel Pineault (2010-2020 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc

All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    7th August 2020 - 06:48 PM