Results 1 to 5 of 5

Thread: [RESOLVED] Cancelling termination event of form in VBA

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Location
    Dublin, Ireland
    Posts
    120

    Resolved [RESOLVED] Cancelling termination event of form in VBA

    Hi,
    Anyone know is there a way of cancelling the termination of a form in VBA? I know theres a cancel event with the unload method of a form in VB6 but not how the same can be done in VBA and I can't find an unload event in VBA.
    Thanks.

  2. #2
    Lively Member adifel's Avatar
    Join Date
    Jan 2006
    Location
    California
    Posts
    103

    Re: Cancelling termination event of form in VBA

    I was looking for the same answer. I have this macro running a userform which suppose to stay on but when run the second time it terminates the form.

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Cancelling termination event of form in VBA

    Just Two questions...

    1) Are you working in VBA Excel?
    2) When you say 'Termination' do you mean the 'Terminate Event' i.e when the user clicks on the Close button?
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Location
    Dublin, Ireland
    Posts
    120

    Re: Cancelling termination event of form in VBA

    Yes,
    when the user clicks the close button. In the termination VBA code, there's no cancel event. There's no form unload event either. How does one stop the the closing of a form in this case?
    Thanks.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2007
    Location
    Dublin, Ireland
    Posts
    120

    Re: Cancelling termination event of form in VBA

    Hi,
    Actually found a solution to this. Was looking at the wrong event. It's not the termination event I should be looking at, it's the QueryClose event. Please look at the following web-site, which provides a solution to this tricky problem.
    http://vb-helper.com/howto_vba_noclose_userform.html
    Thanks for all involved for their help.

Posting Permissions

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



Click Here to Expand Forum to Full Width