"Steve" <th*********@gm ail.com> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
Is there a possibility the account this database is running under does
not have write/modify permissions to either the source or destination
folders (or one level above)? It is my understanding that the
MoveFolder operation mimics a cut 'n' paste operation, which first
copies the object to the destination folder and then deletes it from
the source folder. The account needs to have permissions to delete the
source folder and modify the folder containing it, and permissions to
modify/write to the folder containing the destination folder.
But I can move files. Cut and paste these two functions into a standard
module and test from the immediate window with something like:
?MoveTheseFiles To("C:\NewFolde r1\")
(select any file from the dialog - NewFolder1 must exist)
and
?MoveThisFolder To("C:\NewFolde r2\")
(select any folder from the dialog - NewFolder2 must exist)
You'll get the same results - files get moved no problem, but folders get
hung up on "Error Number 70: Permission denied"
Public Function MoveTheseDocume ntsTo(strDestin ation As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime
Dim varFile as Variant
Dim dlg As Office.FileDial og
Dim fso As Scripting.FileS ystemObject
Set fso = New Scripting.FileS ystemObject
Set dlg = FileDialog(msoF ileDialogFilePi cker)
strDestination = strDestination & varFile
If dlg.Show = True Then
For Each varFile In dlg.SelectedIte ms
fso.MoveFile varFile, strDestination
Next
End If
Set dlg = Nothing
Set fso = Nothing
End Function
Public Function MoveThisFolderT o(strDestinatio n As String)
'required references:
'Microsoft Office 11.0 Object Library
'Microsoft Scripting Runtime
Dim strSource as String
Dim dlg As Office.FileDial og
Dim fso As Scripting.FileS ystemObject
Dim varFldr As Variant
Set fso = New FileSystemObjec t
Set dlg = FileDialog(msoF ileDialogFolder Picker)
'open folder picker dialog
dlg.AllowMultiS elect = False
If dlg.Show = True Then
For Each varFldr In dlg.SelectedIte ms
strSource = varFldr
Next
Debug.Print strSource & " => " & strDestination
'the paths look fine...
'move folder and its contents
If Len(strDestinat ion) Then
fso.MoveFolder strSource, strDestination 'ERROR HERE
End If
End If
Set fso = Nothing
Set dlg = Nothing
End Function