+ Reply to Thread
Results 1 to 4 of 4

Cause workbook to fail to open if user opts to disable macros

  1. #1
    I Believe
    Guest

    Cause workbook to fail to open if user opts to disable macros

    Hi All,
    I need some help in programming my workbook to not open if the user tries to
    open with macros disabled.
    As you know, the user can set the security level to "high", "medium", or
    "low". I would like my workbook to be able to react in the cases where the
    level is set to "high" or "medium" because in these respectively, any macro
    will be automatically disabled or the user prompted to opt to either enable
    or disable all macros.
    So, should the system automatically disable macros or the user ultimately
    decide to disable macros when prompted, I need my workbook to react by
    quickly closing (or not opening at all).
    My idea was to check what security level is in place: if set to "high" then
    force the workbook to immediately close again; but if set to "medium" then to
    capture the user's response event when the system prompts the user, and close
    the workbook if the choice was to disable macros.

    Having taken 20mins to write the above succinctly, it has now occured to me
    that if the system or user disables macros then my code to close the workbook
    won't work anyway (!!)....or will it.
    I guess I'm looking for any ideas - or confirmation that it simply can't be
    done :[

    Thanks and appreciation if you're still with me!

  2. #2
    Ron Coderre
    Guest

    RE: Cause workbook to fail to open if user opts to disable macros

    Here's what I do....
    Write code that does this:

    Upon close....Hide all sheets: xlVeryHidden except one.

    Upon Open...Unhide all sheets.

    That way, if macros are disabled...all they see is the one sheet with a
    message telling them that they need to enable macros to see the rest of the
    workbook.

    It's not bullet-proof....but, it's pretty good.
    Does that help?

    ***********
    Regards,
    Ron

    XL2002, WinXP-Pro


    "I Believe" wrote:

    > Hi All,
    > I need some help in programming my workbook to not open if the user tries to
    > open with macros disabled.
    > As you know, the user can set the security level to "high", "medium", or
    > "low". I would like my workbook to be able to react in the cases where the
    > level is set to "high" or "medium" because in these respectively, any macro
    > will be automatically disabled or the user prompted to opt to either enable
    > or disable all macros.
    > So, should the system automatically disable macros or the user ultimately
    > decide to disable macros when prompted, I need my workbook to react by
    > quickly closing (or not opening at all).
    > My idea was to check what security level is in place: if set to "high" then
    > force the workbook to immediately close again; but if set to "medium" then to
    > capture the user's response event when the system prompts the user, and close
    > the workbook if the choice was to disable macros.
    >
    > Having taken 20mins to write the above succinctly, it has now occured to me
    > that if the system or user disables macros then my code to close the workbook
    > won't work anyway (!!)....or will it.
    > I guess I'm looking for any ideas - or confirmation that it simply can't be
    > done :[
    >
    > Thanks and appreciation if you're still with me!


  3. #3
    Ron Coderre
    Guest

    RE: correction....on save, not on close

    The hiding code should engage when the workbook is SAVED.


    ***********
    Regards,
    Ron

    XL2002, WinXP-Pro


    "I Believe" wrote:

    > Hi All,
    > I need some help in programming my workbook to not open if the user tries to
    > open with macros disabled.
    > As you know, the user can set the security level to "high", "medium", or
    > "low". I would like my workbook to be able to react in the cases where the
    > level is set to "high" or "medium" because in these respectively, any macro
    > will be automatically disabled or the user prompted to opt to either enable
    > or disable all macros.
    > So, should the system automatically disable macros or the user ultimately
    > decide to disable macros when prompted, I need my workbook to react by
    > quickly closing (or not opening at all).
    > My idea was to check what security level is in place: if set to "high" then
    > force the workbook to immediately close again; but if set to "medium" then to
    > capture the user's response event when the system prompts the user, and close
    > the workbook if the choice was to disable macros.
    >
    > Having taken 20mins to write the above succinctly, it has now occured to me
    > that if the system or user disables macros then my code to close the workbook
    > won't work anyway (!!)....or will it.
    > I guess I'm looking for any ideas - or confirmation that it simply can't be
    > done :[
    >
    > Thanks and appreciation if you're still with me!


  4. #4
    I Believe
    Guest

    RE: correction....on save, not on close

    Thanks Ron, just implemented it and it works a treat! Also noticed users
    can't unhide the sheets. Many thanks.

    "Ron Coderre" wrote:

    > The hiding code should engage when the workbook is SAVED.
    >
    >
    > ***********
    > Regards,
    > Ron
    >
    > XL2002, WinXP-Pro
    >
    >
    > "I Believe" wrote:
    >
    > > Hi All,
    > > I need some help in programming my workbook to not open if the user tries to
    > > open with macros disabled.
    > > As you know, the user can set the security level to "high", "medium", or
    > > "low". I would like my workbook to be able to react in the cases where the
    > > level is set to "high" or "medium" because in these respectively, any macro
    > > will be automatically disabled or the user prompted to opt to either enable
    > > or disable all macros.
    > > So, should the system automatically disable macros or the user ultimately
    > > decide to disable macros when prompted, I need my workbook to react by
    > > quickly closing (or not opening at all).
    > > My idea was to check what security level is in place: if set to "high" then
    > > force the workbook to immediately close again; but if set to "medium" then to
    > > capture the user's response event when the system prompts the user, and close
    > > the workbook if the choice was to disable macros.
    > >
    > > Having taken 20mins to write the above succinctly, it has now occured to me
    > > that if the system or user disables macros then my code to close the workbook
    > > won't work anyway (!!)....or will it.
    > > I guess I'm looking for any ideas - or confirmation that it simply can't be
    > > done :[
    > >
    > > Thanks and appreciation if you're still with me!


+ Reply to Thread

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