+ Reply to Thread
Results 1 to 4 of 4

Workbook_BeforeClose(cancel As Boolean)

  1. #1
    Registered User
    Join Date
    02-27-2014
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    13

    Workbook_BeforeClose(cancel As Boolean)

    Hello again all!! thought i would try to get help in using Workbook_BeforeClose(cancel As Boolean) to auto lock 2 sheets (tabs) in one of my workbooks.

    The one tab is called "Employees" (sheet1) and the second tab is called "Employee Info" (sheet 3). Can I get an example as to how to auto relock those 2 tabs after the book is closed?
    Last edited by Vdogeek; 05-23-2014 at 12:29 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Workbook_BeforeClose(cancel As Boolean)

    Hi, Vdogeek,

    only after the book is closed
    I doubt this will be possible. You may use the Event but would need to save the workbook after locking sheets before closing the workbook.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    02-27-2014
    Location
    Winnipeg, Canada
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Workbook_BeforeClose(cancel As Boolean)

    Thanks for pointing that out, I refrased it above..."Can I get an example as to how to auto relock those 2 tabs after the book is closed? "

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Workbook_BeforeClose(cancel As Boolean)

    Hi, Vdogeek,

    and I repeat that this canīt be performed as this action needs to be taken when the workbook is still open, it must be saved and the closed. No code for your request possible Iīm afraid.

    Code goes into ThisWorkbook:
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ 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. 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
  2. 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
  3. [SOLVED] Workbook_BeforeClose: Cancel doesn't work
    By sebt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2006, 06:55 AM
  4. Workbook_BeforeClose - Cancel not working
    By sebt in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-31-2006, 12:40 PM
  5. [SOLVED] Detecting a cancel on Workbook_BeforeClose event?
    By Don Wiss in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2005, 09:06 AM

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