Copy files with Microsoft encryption enabled

M

mcescher

Hi All,
Just ran into a dilly of a problem. A department in our company
decided to turn on the encryption for the Documents and Settings
folder. (right click, properties, advanced, encrypt contents)

A database that I inherited sits in the Application Data folder and
dumps data to Excel and then copies the Excel file to the server.

Since they started turning on the encryption, this fails. Code
follows.

Public Sub UploadToServer()
Dim objFS As Object, strFile As String
Dim strFolder As String
Dim strUploadFolder As String
Dim strUploadArchiveFolder As String
Dim strServerUploadFolder As String
Dim fsoFileSearch As FileSearch
Dim varFile As Variant
'On Error GoTo Sub_Error:
strServerUploadFolder = DLookup("[Path]", "tblSettings",
"[SettingsID]=1")
strServerUploadFolder = Left$(strServerUploadFolder,
InStrRev(strServerUploadFolder, "\"))
strServerUploadFolder = strServerUploadFolder & "Upload"
'create upload directory on server if it doesn't exist
Set objFS = CreateObject("Scripting.FileSystemObject")
If Not objFS.folderexists(strServerUploadFolder) Then
objFS.createfolder (strServerUploadFolder)
End If
Set fsoFileSearch = Application.FileSearch
strUploadFolder = CurrentProject.Path & "\LC_DB_Upload"
strUploadArchiveFolder = CurrentProject.Path & "\LC_DB_Upload
\Archive"
With fsoFileSearch
.NewSearch
.LookIn = strUploadFolder
.FileName = "*.xls"
.SearchSubFolders = False
If .Execute() > 0 Then
For Each varFile In .FoundFiles
Debug.Print varFile, strServerUploadFolder
'**********************************
'* Blows up on the following line *
'**********************************
objFS.copyfile varFile, strServerUploadFolder & "\"
Next varFile
For Each varFile In .FoundFiles
Debug.Print varFile, strUploadArchiveFolder
objFS.MoveFile varFile, strUploadArchiveFolder & "\"
Next varFile
End If
End With
Debug.Print fsoFileSearch.FoundFiles.Count
Exit Sub
Sub_Error:
MsgBox Err.Number & ": " & Err.Description, vbCritical, "LC DB:
Error."
End Sub

Fires off error -2147018896: Method of 'CopyFile' of object
'IFileSystem3' failed

This function worked fine until the ecryption was turned on. So, I
wrote a batch file
to do the copy, and called it from access. That also bombed with "The
file can not be encrypted" error message.

HELP!! How can I get my files copied to the server?

Chris M.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top