Good day,
I've built a vba project that displays a userform login form via the open event. If user opens the document with macros disabled, the open event doesn't trigger and the user login form doesn't open. To address this, I've created a 'launch sheet' that is made visible during the close event while all other sheets are made 'very hidden'. If user opens with macros enabled and enters correct login/password, the launch sheet is re-hidden and the applicable sheets are made visible. If user opens with macros disabled, all they see is the launch page with a message advising must enable macros. Combined with VBA password protection, this approach appears to protect the document at least against the casual user.
However... the above only works if i force save the document during the close event. If I allow the user to close without saving, the 'very hide' code within the close event has no impact since the visible property changes aren't saved. So the way i have this set up currently the user has no way to close the document without saving their changes (except maybe thru task manager (?) etc. haven't tested that).
Is there any workaround here? A way to save changes to the visible sheet properties during the close event without requiring the user to save changes to the actual data?
I've built a vba project that displays a userform login form via the open event. If user opens the document with macros disabled, the open event doesn't trigger and the user login form doesn't open. To address this, I've created a 'launch sheet' that is made visible during the close event while all other sheets are made 'very hidden'. If user opens with macros enabled and enters correct login/password, the launch sheet is re-hidden and the applicable sheets are made visible. If user opens with macros disabled, all they see is the launch page with a message advising must enable macros. Combined with VBA password protection, this approach appears to protect the document at least against the casual user.
However... the above only works if i force save the document during the close event. If I allow the user to close without saving, the 'very hide' code within the close event has no impact since the visible property changes aren't saved. So the way i have this set up currently the user has no way to close the document without saving their changes (except maybe thru task manager (?) etc. haven't tested that).
Is there any workaround here? A way to save changes to the visible sheet properties during the close event without requiring the user to save changes to the actual data?