The QueryClose event in Visual Basic.
How to disable the close button on UserForm in Excel VBA?
Prohibiting the user from using the Close command from the Control menu on the UserForm.
If the user has chosen the Close command from the Control menu on the UserForm, the "CloseMode" should be assigned with the constant "vbFormControlMenu" which is equivalent to a value of "0".
Eg. CloseMode = vbFormControlMenu or CloseMode = 0.
To stop the QueryClose event in all loaded UserForm's and prevent them from closing, the argument "Cancel" should be set to any value other then "0".
Eg. Cancel = 1, Cancel = True or Cancel = 2.
Excel & VBA discussion public group 👉 / 486402069483674
Welcome to join and feel free to raise/ask questions (if any) or share Excel tricks 🤗
#excel #vba
Watch video How to disable the close button on UserForm in Excel VBA online without registration, duration hours minute second in high quality. This video was added by user Ah Sing Excel TV 11 October 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,490 once and liked it 31 people.