+ Reply to Thread
Results 1 to 4 of 4

Macro to remove all macros

  1. #1
    Forum Contributor
    Join Date
    12-01-2010
    Location
    Southampton, England
    MS-Off Ver
    Excel 2007
    Posts
    303

    Macro to remove all macros

    Hello all, as always thank you for taking the time to look at my problem. Sounds a crazy thing to want to do, but my aim is to supply these spreadsheets as data to collegues. I would like to provide them a macro free version, im not sure if it is possible to have a
    'suicidal' macro, deleting all macros including its self?

    Strange request but this is what i need.

    All the best

    Alan

  2. #2
    Forum Expert Whizbang's Avatar
    Join Date
    08-05-2009
    Location
    Greenville, NH
    MS-Off Ver
    2010
    Posts
    1,395

    Re: Macro to remove all macros

    I haven't tested it, but a quick Google search gave me this.

    http://www.exceltip.com/show_tip/Mod...Excel/505.html

    I assume that you would actually house the procedure in your "Personal" workbook and run it from there. This way there is no "deleting itself" paradox.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Macro to remove all macros

    hello ad9051,

    Here is a better version. This does not require adding a reference to the workbook and will automatically unlock your VBA Project, if you have it locked, by supplying the password.

    This code removes all macros in the workbook that this macro runs in. The macro deletes itself as well.

    Remove All Macros and Unlock VBA Project
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Macro to remove all macros

    If you save your file as a "xlsx" file the macros will automatically be removed... could'nt you just save the distibution copy as the "xlsx" version ?

+ 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