Hi, what I'm trying to do:
I have a read-only file. I want to save the file AFTER I did some changes to it.
I got a VBA code, but it only works if the file is 100% the same (no changes were made):
Could somebody please tell me how to save the read-only file also when I made changes? (and save as read-only again!)
Reason: Part of an automatized update routine
edit: The problem is basically that I can't remove read-only If I changed something within the file.
Thanks alot
I have a read-only file. I want to save the file AFTER I did some changes to it.
I got a VBA code, but it only works if the file is 100% the same (no changes were made):
Code:
Sub SaveAfterUpdate()
If ActiveWorkbook.ReadOnly Then
With ActiveWorkbook
SetAttr .FullName, vbNormal
.ChangeFileAccess Mode:=xlReadWrite, WritePassword:="admin"
Application.DisplayAlerts = False
.Save
Application.DisplayAlerts = True
.ChangeFileAccess Mode:=xlReadOnly, WritePassword:="admin"
End With
Else
With ActiveWorkbook
Application.DisplayAlerts = False
.Save
Application.DisplayAlerts = True
.ChangeFileAccess Mode:=xlReadOnly, WritePassword:="admin"
End With
End If
End Sub
Could somebody please tell me how to save the read-only file also when I made changes? (and save as read-only again!)
Reason: Part of an automatized update routine
edit: The problem is basically that I can't remove read-only If I changed something within the file.
Thanks alot

Last edited: