• UserForm Property (97)

    Author
    Topic
    #382137

    I have a UseForm that prompts for a password and it works beautifully except for one oversight. The close icon (the X at top right) can be clicked and the form closes exposing the works.
    I’d be really chuffed if someone would supply the code to prevent this from showing.

    Cheers

    Rob

    Viewing 1 reply thread
    Author
    Replies
    • #646804

      Use the following code (place it in the Userform code module) to prevent closure by use of the x button

      Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
      If CloseMode = 0 Then Cancel = True
      End Sub

      Andrew C

      • #646813

        Thanks Andrew. That’s tidied up project nicely.

        Cheers

        Rob

    • #646930

      Another thing to do is to hide all that must be hidden from view once no or a wrong password is entered. Then unhide what may be seen once a valid password is entered. This also avoids trouble when a user opens the file with macros disabled.

    Viewing 1 reply thread
    Reply To: UserForm Property (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: