+ Reply to Thread
Results 1 to 3 of 3

UserForm_QueryClose questions

  1. #1
    Don Wiss
    Guest

    UserForm_QueryClose questions

    Behind my user form I have a UserForm_QueryClose macro. This as I would
    like people to confirm when they press the Escape key. I want them to
    realize they will be closing the form and not saving any changes to their
    input data. If I set the Cancel property on my cancel button to False, then
    the escape key is not allowed. If I set it to True, escape works, the
    UserForm_QueryClose macro is called, but I can't tell that an escape was
    pressed instead of the Cancel button being clicked.

    What I observe is when escape is pressed, or the done or cancel buttons are
    clicked (all are doing unloads), inside the macro Cancel=0 and CloseMode=1.
    If the X in the upper right of the form is clicked, Cancel=0 and
    CloseMode=0. Is there any other more useful information that can be
    accessed so I can do what I want? I suspect not. (When does Cancel=1?)

    Don <www.donwiss.com> (e-mail link at home page bottom).

  2. #2
    Bob Phillips
    Guest

    Re: UserForm_QueryClose questions

    From help, the values for closemode

    vbFormControlMenu 0 The user has chosen the Close command from the
    Control menu on the UserForm.
    vbFormCode 1 The Unload statement is invoked from code.
    vbAppWindows 2 The current Windows operating environment session is
    ending.
    vbAppTaskManager 3 The Windows Task Manager is closing the
    application.


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Don Wiss" <donwiss@no_spam.com> wrote in message
    news:g5i14196c9un7jq3kuo75s1g8rarum9ndo@4ax.com...
    > Behind my user form I have a UserForm_QueryClose macro. This as I would
    > like people to confirm when they press the Escape key. I want them to
    > realize they will be closing the form and not saving any changes to their
    > input data. If I set the Cancel property on my cancel button to False,

    then
    > the escape key is not allowed. If I set it to True, escape works, the
    > UserForm_QueryClose macro is called, but I can't tell that an escape was
    > pressed instead of the Cancel button being clicked.
    >
    > What I observe is when escape is pressed, or the done or cancel buttons

    are
    > clicked (all are doing unloads), inside the macro Cancel=0 and

    CloseMode=1.
    > If the X in the upper right of the form is clicked, Cancel=0 and
    > CloseMode=0. Is there any other more useful information that can be
    > accessed so I can do what I want? I suspect not. (When does Cancel=1?)
    >
    > Don <www.donwiss.com> (e-mail link at home page bottom).




  3. #3
    Bob Phillips
    Guest

    Re: UserForm_QueryClose questions

    BTW, Cancel is an argument that you determine the value (true or False)
    depending upon whether you want to continue the Cancel or quit it. It should
    always enter False.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Don Wiss" <donwiss@no_spam.com> wrote in message
    news:g5i14196c9un7jq3kuo75s1g8rarum9ndo@4ax.com...
    > Behind my user form I have a UserForm_QueryClose macro. This as I would
    > like people to confirm when they press the Escape key. I want them to
    > realize they will be closing the form and not saving any changes to their
    > input data. If I set the Cancel property on my cancel button to False,

    then
    > the escape key is not allowed. If I set it to True, escape works, the
    > UserForm_QueryClose macro is called, but I can't tell that an escape was
    > pressed instead of the Cancel button being clicked.
    >
    > What I observe is when escape is pressed, or the done or cancel buttons

    are
    > clicked (all are doing unloads), inside the macro Cancel=0 and

    CloseMode=1.
    > If the X in the upper right of the form is clicked, Cancel=0 and
    > CloseMode=0. Is there any other more useful information that can be
    > accessed so I can do what I want? I suspect not. (When does Cancel=1?)
    >
    > Don <www.donwiss.com> (e-mail link at home page bottom).




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1