Hi,
I am starting with a protected workbook. I then run a macro. I know you can at the start of the macro, unprotect it and then at the end protect it but this leaves room for an unprotected workbook if the macro crashes.
So to get rid of that scenario I want to only allow the macro to work with the workbook.
I've tried:
I get an error. Plus this doesn't make sense, since the workbook is protected from the get-go (before the macro makes this call)
Any solutions without un-protecting and then re-protecting?
Thanks in advance. Kind regards.
I am starting with a protected workbook. I then run a macro. I know you can at the start of the macro, unprotect it and then at the end protect it but this leaves room for an unprotected workbook if the macro crashes.
Code:
ActiveWorkbook.Unprotect Password:="xxx"
ActiveWorkbook.protect Password:="xxx"
I've tried:
Code:
ActiveWorkbook.Protect userinterfaceonly:=True
Any solutions without un-protecting and then re-protecting?
Thanks in advance. Kind regards.