+ Reply to Thread
Results 1 to 4 of 4

how to vba force user to trust center and enable all macros?

  1. #1
    Registered User
    Join Date
    05-21-2018
    Location
    Malaysia
    MS-Off Ver
    2016
    Posts
    94

    how to vba force user to trust center and enable all macros?

    because i want user to use the userform when they open up the excel workbook.
    i had set workbook_open to open the userform when user open the excel file but they are need to enable content so they can bypass the userform via not click the enable content.

    so did any way to write an vba to force user to trust center and enable run all macros?


    Thanks.

  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,464

    Re: how to vba force user to trust center and enable all macros?

    I guess that would rather defeat the object of having Trust Center Settings, wouldn't it? You send me a workbook that I open and run that doesn't do anything noticeable but, in the background, it tears a FOB hole in my security settings. Then you send me another workbook that just executes and does whatever it wants. I don't think so.
    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
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: how to vba force user to trust center and enable all macros?

    Good morning Step01

    There is no concrete way to force a user to accept macros, and certainly no way to access the trust Centre via VBA - all this is very deliberately not exposed to the VBA object model - for very good reasons.

    That said there are some techniques which may help "persuade" a user that it may be a good idea to allow macros to run.

    Two such techniques are discussed here. Neither are perfect but staying within the confines of Excel, it's the best you're going to get.
    http://www.cpearson.com/Excel/EnableMacros.aspx
    http://www.cpearson.com/Excel/EnableMacros2.aspx

    HTH

    DominicB

  4. #4
    Forum Expert
    Join Date
    10-02-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    1,222

    Re: how to vba force user to trust center and enable all macros?

    As mentioned already this is not really possib... or better put recommended, as it would defeat the purpose of such protections put into place.

    Its generally a bad idea to alter any users settings via VBA, you are just asking for them to come after you with pitchforks and torches even if you had good intents. As soon as something doesnt work the way it should/they expect, it becomes your fault and most companies/people will hold you accountable. You are much better off providing people directions for use.

    There are perimeter issues to consider too. If they get the file from the internet or network drive Windows can place a block on the file too, so even if you trust it in Excel, it still wont work right.

    Also, what if the user cant change trust center settings themselves due to Group Policy or other rules enforced by an IT dept? Then even if you had code to enable macros it couldnt change the setting.

    Lastly, its chicken and egg...How can you run your macro to alter the trust center to allow running macros if you cant run macros?

    Despite my better judgement, heres a link to help you start should you want to try this...

    https://msdn.microsoft.com/en-us/vba...property-excel

    The settings for this are exposed to the object model afterall...
    Ways to get help: Post clear questions, explain your overall goal, supply as much background as possible, respond to questions asked of you by those trying to help and post sample(s) files.

    "I am here to help, not do it for people" -Me

+ 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. Replies: 0
    Last Post: 05-22-2017, 08:11 AM
  2. Force User to enable Macros
    By mvassallo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-17-2017, 08:44 AM
  3. Keyboard Shortcut To Trust Document/Enable Macros
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2015, 05:41 PM
  4. Excel 2010 - Lock out Trust Center settings for Disabling All Macros?
    By tv69 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-13-2014, 10:31 AM
  5. Force user to enable macros, only work if press save
    By Blokeman in forum Excel General
    Replies: 0
    Last Post: 03-09-2013, 10:25 PM
  6. Force User to Enable Macros - Issue with activating specific sheet afterwards...
    By aboveliquidice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2009, 04:27 PM
  7. Enable Macros - Trust my file on my PC
    By Bafa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-10-2008, 09:24 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