Apologies if I have posted this thread incorrectly, I am a first time user and this is the first time I am posting a thread.
I am trying to close an excel file but to do this I need to set a prompt that will ask the user if they have set a password to the sheet. If they answer no the file does not close which is fine, but I also need for the password screen to appear for the user to set a password(tools > options > security)
How do I do this?
This is the code I am using to prompt the user before close:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Response As Long
Response = MsgBox("Have you set a password to this file?", vbYesNo)
If Response = vbNo Then
Cancel = True
Can I have help on this matter today please, need to complete and send out