I need to amend the following code so that when it copies the folder it retains all the permissions I think maybe xcopy will work but I don't know how to amend the code to make it work...would really appreciate any help...
Code:
Private Sub Command27_Click()
'This example copy all files and subfolders from FromPath to ToPath.
'Note: If ToPath already exist it will overwrite existing files in this folder
'if ToPath not exist it will be made for you.
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
If IsNull(Me.Client) Then
DoCmd.Close
Exit Sub
End If
FromPath = "Q:\01-Estimating\1.1-Tender Files\_Tender File" '<< Change this to final drive location sharon ***
ToPath = "Q:\01-Estimating\1.1-Tender Files\" & (Text93) '<< Change sharon ***
'If you want to create a backup of your folder every time you run this macro
'you can create a unique folder with a Date/Time stamp.
'ToPath = "C:\Users\Ron\" & Format(Now, "yyyy-mm-dd h-mm-ss")
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 "A Tender File has now been created for this project on " & ToPath
DoCmd.Close
End Sub