+ Reply to Thread
Results 1 to 4 of 4

VBA Code to Know Macro Enable or Disable when Open workbook

  1. #1
    Registered User
    Join Date
    01-29-2015
    Location
    London
    MS-Off Ver
    MS 2010
    Posts
    6

    Lightbulb VBA Code to Know Macro Enable or Disable when Open workbook

    Hello all,

    My problem is that I need to prevent from another person who try to copy my worksheet to use with other computer without authorization from me.
    Thus, I tried to wirte coding for closing my workbook when it is used with other unathorized computer but in order to run this script, I need to enable macro at all the time my workbook open.

    As my idea, I have to write coding for checking excel whether Macro enable or disable when we are open it. If Macro disable, workbook must be closed automatically. (I tried to write this code but it is impossible).

    Is any one have ideas to help me?

    Thanks in advance for sharing your ideas.

    David,

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: VBA Code to Know Macro Enable or Disable when Open workbook

    Please Login or Register  to view this content.
    Well, mmm, if macros aren't enabled for this workbook, it doesn't matter what code you have, it won't run. So easy: macros not enabled = code doesn't run.

    What that means is that you need to make your workbook unusable unless macros are enabled. That, in turn, means hiding all the data worksheets and displaying a "Splash Screen" saying something like: "please enable macros to use this workbook". Then you can have code to try to prevent people from saving it or doing things with it you don't want them to.

    Being realistic, most preventative measures will only stop some people. Anyone with an interest in Excel and VBA, and access to the Internet, will be able to remove or work around most protection.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-29-2015
    Location
    London
    MS-Off Ver
    MS 2010
    Posts
    6

    Re: VBA Code to Know Macro Enable or Disable when Open workbook

    Thank TMS for your advice.

    Yes, as you said "Anyone with an interest in Excel and VBA, and access to the Internet, will be able to remove or work around most protection".

    That is what I concern about.

    Is there any more of comments?

    Thanks!

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: VBA Code to Know Macro Enable or Disable when Open workbook

    How about storing you macros in you personal workbook?

    http://chandoo.org/wp/2013/11/18/usi...acro-workbook/

    Alf

+ 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. Enable/Disable vba code
    By henk400 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2015, 08:16 AM
  2. enable/disable stuff on open/close
    By sabha in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-19-2014, 02:26 AM
  3. [SOLVED] Code to disable and enable indentations
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2014, 01:38 PM
  4. Disable Workbook Open Event Until Other Code has finished Executing
    By dgdgdg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2013, 05:36 AM
  5. [SOLVED] Enable/Disable Save As in workbook
    By motolich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-07-2013, 10:58 AM
  6. prevent workbook from open if user does not enable macro
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2011, 01:51 PM
  7. disable and enable macro execution using VBA in another workbook?
    By keithb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2005, 02:05 PM

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