+ Reply to Thread
Results 1 to 10 of 10

closing form window with X - what happens

  1. #1
    Registered User
    Join Date
    11-30-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    54

    closing form window with X - what happens

    Hi,

    I have a userform. When activated global variable is set to true (to prevent from opening other forms).
    When form is closed as designed (after pressing a button) variable is set to false.

    When I close form by clicking X in right top corner terminate event seem not to appearer.

    What happens when user closes window with X? and haw can I use this.

    Cris

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: closing form window with X - what happens

    Terminate event should fire with any close of form but you may also use QueryClose event to prevent user closing form with X if you wish.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    11-30-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    54

    Re: closing form window with X - what happens

    Hi,
    thanks.

    I looked in help and closemode has 4 possible values.

    I however am not sure which would be responsible for clicking X in window title bar.

    would it be 0?

    Regards,
    Cris

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: closing form window with X - what happens

    Yes - or vbFormControlMenu:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-30-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    54

    Re: closing form window with X - what happens

    Hi,

    I did find something.

    In first I thought that terminate event did not fire when closing form. Code was like this:

    Please Login or Register  to view this content.
    where Dodanie_nowego is name of this particular form

    this did not work

    When I tried:

    Please Login or Register  to view this content.
    it started to work.

    Is this OK?

    Cris

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: closing form window with X - what happens

    Yes that is correct. You must not change the 'Userform' section of the event declaration to match your form name.

  7. #7
    Registered User
    Join Date
    11-30-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    54

    Re: closing form window with X - what happens

    Hi,

    I have similar problem with closing filedialog with X.
    But administrator closed my thread about this.

    Can you advise me on how to solve the other problem too.

    http://www.excelforum.com/excel-prog...g-problem.html

    Cris

  8. #8
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: closing form window with X - what happens

    What is the code you have for filedialog?

    I think you should tell the moderator that it is a different question - userform and filedialog are not the same.

  9. #9
    Registered User
    Join Date
    11-30-2013
    Location
    Poland
    MS-Off Ver
    Excel 2013
    Posts
    54

    Re: closing form window with X - what happens

    Hi,

    I know to little to discus with moderator. I really do not know it his is the same or not because I can not do that. If I did I would know.\

    code for filedilog is as follows:

    Please Login or Register  to view this content.
    I am getting an error on line

    zdjecie_fp = .SelectedItems(1)

    if I close this window by X.

    Cris.

    ps. I have terminate event working now thanks

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: closing form window with X - what happens

    You may test result of Show method:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pop-Up Window Before Closing If ...
    By mjwillyone in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2013, 01:37 PM
  2. Closing macro window
    By DaveLearner in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-05-2010, 11:30 AM
  3. Pop up window when closing excel
    By pixiesoft in forum Excel General
    Replies: 3
    Last Post: 10-12-2009, 01:55 PM
  4. Closing Immediate window
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-20-2009, 11:43 AM
  5. Closing window issues
    By IamNutz in forum Excel General
    Replies: 1
    Last Post: 02-09-2007, 05:36 PM

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