The following code will hide the whole title bar of the UserForm window. Why would you want to do this? The only time I do is when showing a modeless 'progress bar' dialog. Leave a comment to let me know why you would do this!
1. In the UserForm's code in the declarations area, add the Windows API calls and associated constants
2. And in the UserForm's code in the procedures area, add this SetNoTitleBar procedure
3. And from the UserForm_Initialize event, call the SetNoTitleBar procedure
4. Display the UserForm (in this example called UserForm1) from a standard code module eg
5. You will need to reduce the height of your UserForm as it doesn't automatically adjust for the absence of the title bar as you see in the following images ...
UserForm with title bar:
And UserForm without title bar:
I use the Hide Title Bar function in most of the applications I write (especially when the app has multiple display windows) - and add a QUIT button on my Menu Page.
In this way, the user cannot simply close the window using the Red X. They have to use the QUIT button to exit/close the application.
Then, I can ask if they are sure they wish to exit the application (and display a warning if they are in the middle of a particular task).
I can also call any Save functions that may be required prior to closing the application.
Basically, I have control and can ensure the application is closed gracefully.
However, running some of my apps on…