Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 27

Thread: Automatically Close Workbook If Macros Are Disabled

  1. #1
    Join Date
    18th July 2006
    Posts
    21

    Automatically Close Workbook If Macros Are Disabled

    If a user disables macros when opening a file, is there a way to have the excel file automatically close?

    Thanks!

    - Steve

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    12th September 2006
    Location
    The Great State of Texas
    Posts
    4,322

    Re: Closing Workbook Automatically If Macros Are Disabled

    That would require a macro ...

    But you could keep a user from seeing any data.
    Entia non sunt multiplicanda sine necessitate.
    MS MVP - Excel

  3. #3
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

    Re: Closing Workbook Automatically If Macros Are Disabled

    Nope. See http://www.ozgrid.com/download/ and download EnableMacros.zip

    However, this is FAR from bullet proof and relies on the user saving upon close. Personally, whether the user wants to enable macros, or not, is entirely up to them.

  4. #4
    Join Date
    18th July 2006
    Posts
    21

    Re: Automatically Close Workbook If Macros Are Disabled

    Thanks to both of you for the quick reply!

    To qualify my question, I agree, Dave, that the user has (and should have) the right to decide whether to open files with macros. I don't want to force users to accept the macro if they're not comfortable with it; I'm more concerned that if they don't accept the macro, the results they see in the file won't be right, and they'll rely on bad info.

    Thanks again.

    - Steve

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

    Re: Automatically Close Workbook If Macros Are Disabled

    Yes, I figured that. However, from my experience end users are VERY easily confused by the numerous pit-falls the above code has. In fact, it often causes more problems than it resolves.

    I would simply email each user (and keep a record for butt covering) to each end user telling them that macros MUST be enabled and explain how to set their security level to Medium.

  6. #6
    Join Date
    24th February 2008
    Posts
    7

    Re: Automatically Close Workbook If Macros Are Disabled

    Quote Originally Posted by Dave Hawley
    I would simply email each user (and keep a record for butt covering) to each end user telling them that macros MUST be enabled and explain how to set their security level to Medium.
    Hi Dave,
    I have faced the issue in discussion quite often at work and here's what I've done:

    I have created a separate Sheet with a simple message to the users about the macro security level being set to high (and that they should set it to medium by doing bla...bla...bla... and then reopen the file).

    The workbook activates this sheet every time the file is saved and closed (Workbook_BeforeClose event).

    In this way, the next time the file opens, if security is high, the users see the message and take the appropriate action.

    In case security is medium or low, this sheet gets hidden and so the users see whatever they are supposed to see.

    So far, it has saved me from dozens of phone calls and e-mail going back and forth.

    Excel Video Tutorials / Excel Dashboards Reports


  7. #7
    Join Date
    17th April 2007
    Posts
    4

    Re: Automatically Close Workbook If Macros Are Disabled

    Dave,

    This is what I use - obviously you can get around it quite simply, but if you protect the VBA project you make it that little bit harder...

    I have an EnableMacros sheet that will show how the user either enables macros or changes macro security levels.

    This sheet is always displayed unless the user enables macros.

    Hope it helps.
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,708

    Re: Automatically Close Workbook If Macros Are Disabled

    tstav and Magriza, all the user has to do is Enable Macros, then cloose WITHOUT saving.

  9. #9
    Join Date
    12th September 2006
    Location
    The Great State of Texas
    Posts
    4,322

    Re: Automatically Close Workbook If Macros Are Disabled

    But the macros could do a Save (with the usual hiding) in the BeforeClose event. And in the Save event they could do the hiding before save and restoring after save transparently to the user.

    No?
    Entia non sunt multiplicanda sine necessitate.
    MS MVP - Excel

  10. #10
    Join Date
    8th December 2006
    Location
    New Zealand
    Posts
    3,913

    Re: Automatically Close Workbook If Macros Are Disabled

    The attached file works on the same principle as Dave's enable macros but it does not require the user to save upon close.

    I had to modify it slightly because my original file also featured a login screen.
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Close Workbook If Macros Not Enabled
    By hgus393 in forum EXCEL HELP
    Replies: 1
    Last Post: February 11th, 2008, 20:50
  2. Macros Disabled In A Shared Workbook
    By mary63 in forum EXCEL HELP
    Replies: 3
    Last Post: January 18th, 2007, 05:59
  3. Automatically Close Workbook Between Times
    By torpedo13 in forum EXCEL HELP
    Replies: 10
    Last Post: December 21st, 2006, 02:19
  4. Automatically Close Workbook If Another Opened
    By KnuckleMonkey in forum EXCEL HELP
    Replies: 7
    Last Post: October 31st, 2006, 12:15
  5. Macros Disabled. Macros Wont Run
    By ChrisOK in forum EXCEL HELP
    Replies: 3
    Last Post: February 1st, 2006, 11:55

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
  •  
porno