+ Reply to Thread
Results 1 to 3 of 3

Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true

  1. #1
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true

    I have macros that run in Workbook_BeforeClose(Cancel As Boolean) I want to exit if a public Boolean equals true. The Boolean is to be set by any one of the macro that is called but I am not able figure out how to terminate the Workbook_BeforeClose(Cancel As Boolean) and stop it from closing excel.

    Thank you for any and all of your help
    Bramz

  2. #2
    Forum Expert (Lazarus)
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    .
    Posts
    2,594

    Re: Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true

    In the Workbook_BeforeClose event handler, just set the parameter 'Cancel' to the value of your public var.
    Please Login or Register  to view this content.
    If varName is True, then Cancel is set True and the workbook will not unload.

  3. #3
    Valued Forum Contributor meabrams's Avatar
    Join Date
    10-03-2014
    Location
    USA
    MS-Off Ver
    2007, 2010, 2013, 2016
    Posts
    451

    Re: Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true

    That was almost to easy thank you for your help

    Bramz
    Last edited by meabrams; 09-20-2016 at 06:11 AM. Reason: type-o

+ 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. Cancel as Boolean argument
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2015, 01:29 PM
  2. [SOLVED] Cancel As Boolean Help
    By Kiotofl in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-25-2014, 11:26 AM
  3. [SOLVED] Private Sub Workbook_BeforePrint(Cancel As Boolean) Range Issue (2007)
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-16-2014, 10:31 AM
  4. Workbook_BeforeClose(cancel As Boolean)
    By Vdogeek in forum Excel General
    Replies: 3
    Last Post: 05-23-2014, 12:39 PM
  5. Private Sub Workbook_BeforePrint(Cancel As Boolean) not executing procedures
    By Burrswood in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2013, 11:48 AM
  6. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) problem
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2009, 07:28 PM
  7. [SOLVED] Boolean 0/1 instead of True/False
    By Tony in forum Excel General
    Replies: 10
    Last Post: 05-28-2006, 11:20 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