+ Reply to Thread
Results 1 to 3 of 3

Macro to auto shut down workbook

  1. #1
    Forum Contributor
    Join Date
    10-16-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    257

    Macro to auto shut down workbook

    Hi

    is there a way to automatically shut down the workbook with a macro, but it would need to use some sort of lookup.

    Sheet1 A1 would have the application user name (I already have this macro)

    Column B would have the list of names that can use the workbook

    if the name in A1 does not match whats in the list, the workbook would shutdown, else it stays open.

    Passwords in this place lasts a week before having to change them again, so this is the only way to keep unwanted people out.

    Thanks

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Macro to auto shut down workbook

    if you have a button that the user clicks to check details & then enter workbook,
    then use a lookup procedure to check the name exists.
    if it exists then enter work book.
    if not then call this macro
    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    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,198

    Re: Macro to auto shut down workbook

    Hi, Dibbley247,

    as
    Please Login or Register  to view this content.
    may be changed by each user IŽd recommend to rely on
    Please Login or Register  to view this content.
    which is the name unbder which the user is logged-in into the computer.

    Instead of using VLookUp you could use CountIf. And you may either make it all capitals or lowercase for comparision.

    Use the Workbook_Open-event in ThisWorkbook for starting an automatic check when macros are enabled.

    Ciao,
    Holger
    Last edited by HaHoBe; 06-22-2014 at 04:28 AM.
    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

  4. #4
    Registered User
    Join Date
    06-20-2014
    Location
    Scotland
    MS-Off Ver
    2010 & 2013 professional
    Posts
    16

    Re: Macro to auto shut down workbook

    in the workbook.open event

    Please Login or Register  to view this content.
    this will return the row number it finds the match in to the variable, if no match is found the error causes it to jump to the exit.



    Sent from my HTC One_M8 using Tapatalk
    Last edited by dgwebster; 06-22-2014 at 06:45 AM.

  5. #5
    Forum Contributor
    Join Date
    10-16-2009
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    257

    Re: Macro to auto shut down workbook

    Looks like what i need! I'll just change the workbook saved to FALSE as i wouldn't want it saved (But then if changes wasn't made, it wouldn't matter)
    But after discussion, it now looks like a different method is needed.

    Same setup, but:
    Checks the list of names, if it's there then open it (like what you have) else open as read only? Could this be done?

    Thanks

+ 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. VBA Code to Auto Shut Down Sheet After 5 Minutes
    By Angnz in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-26-2014, 11:58 AM
  2. [SOLVED] Tryng to shut down / disable Excell auto-parsing
    By opelgol2k in forum Excel General
    Replies: 6
    Last Post: 04-23-2012, 03:50 PM
  3. [SOLVED] Does protecting a workbook shut off VBA code?
    By Stilla in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2006, 03:40 AM
  4. [SOLVED] Does protecting a workbook shut off VBA code?
    By Stilla in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2006, 10:30 AM
  5. Does protecting a workbook shut off VBA code?
    By Stilla in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2006, 10:25 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