I am trying to save a workbook read only in a folder selected by the user. I am get the code for allowing the user to select a folder; but when it comes to the setting read only attribute, this is not working. It appears to work, but then when I try to have another user open the file, they are able to open the file, make changes to the file, and save the file with the same name. At not time do they get a "ReadOnly" message. Below is my code, can anyone help, please?
Thank you!
Thank you!
Code:
Sub GetFolder()
Dim fldr As FileDialog
Dim sItem As String
Dim strPwd As String
Dim strPath As String
Dim FileName As String
'strPwd = InputBox("Enter the password")
strPath = "M:\YM07\Group\d031\Account\NDL Journal Entries\2013\"
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = strPath
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
Set fldr = Nothing
ActiveWorkbook.SaveAs
ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
ChDir "M:\YM07\Group\d031\Account\NDL Journal Entries\2013"
End Sub
[code]
Last edited: