How to disable the close button on UserForm in Excel VBA

Опубликовано: 11 Октябрь 2022
на канале: Ah Sing Excel TV
2,490
31

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


Смотрите видео How to disable the close button on UserForm in Excel VBA онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Ah Sing Excel TV 11 Октябрь 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 2,490 раз и оно понравилось 31 людям.