MrExcel Publishing
Your One Stop for Excel Tips & Solutions

DISABLE CLOSE "X" BUTTON, AND LOCK FORM POSITION


Posted by MIKE K on June 12, 2001 11:40 AM

IS THERE ANY WAY TO DISABLE THE CLOSE BUTTON (VBA), AND ALSO HAVE A FORM COME UP FULL SCREEN SO IT HIDES EXCEL, AND DOESNT ALLOW THE END USER TO MOVE THE FORM. FOR SECURITY PURPOSES.THANKS!


Posted by Ron on June 12, 2001 11:48 AM

I can help you with the disabling of the close button. This code will give the user a message that they button is disabled. This is the code I use on most of my forms. Put it in the Form's QueryClose event.
'Prevent user from using "x" button to close
If CloseMode = vbFormControlMenu Then
MsgBox "Choose an option. Use of the Close button isn't permitted."
Cancel = True
End If