Results 1 to 2 of 2

Disable close workbook but still force users to close thru command button

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2013
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    1

    Disable close workbook but still force users to close thru command button

    I want the users to complete the tak and exit only through the command button which I have created on the worksheet. I have been trying with the following code, but it also stops when closing through command button (macros). Can any body help me on this?

    This WorkBook Module
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If BooleanForClosing = False Then
    Cancel = True
    End If
    End Sub
    Sheet Module
    Public BooleanForClosing As Boolean
    Private Sub CommandButton1_Click()
    BooleanForClosing = True
    ThisWorkbook.Close (SaveChanges = Yes)
    End Sub
    Last edited by JosephP; 01-18-2013 at 07:29 AM. Reason: add code tags

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