disable the save and saveas button and Suppress Macro warning

Posted on 2006-05-22
Last Modified: 2008-02-01
1) How to write code to disable the save and saveas button?

2) How to force the file opener to execute the Excel VBA (Suppress the Macro Warning)?
Question by:howardching
    LVL 8

    Expert Comment

    i dunn have the exact idea of how to disable a menu button
    but u need to know the control ID of the button which u want to be Disabled
    and u need to go to the console for that
    click start->Run->Type "MMC" and press enter
    here u go
    this is the console and from here itself u can disable those buttons (but how....i dunn know....sorry 4 dat)

    2) How to force the file opener to execute the Excel VBA (Suppress the Macro Warning)?

    it has something to do with security level
    if security level is set to High den there will be a warning and if it is low den d macro will run without any warning
    LVL 35

    Accepted Solution

    Hi Howard,

    1) If you mean File/Save and File/Save As, you would use:

     With Application.CommandBars("Worksheet Menu Bar").Controls("File")
      .Controls("Save").Enabled = False
      .Controls("Save As...").Enabled = False
     End With

    And if you are referring to the buttons on the toolbar:

     Application.CommandBars("Standard").Controls("Save").Enabled = True
     Application.CommandBars("Standard").Controls("Save As...").Enabled = True

    2) You cannot suppress the macro warning via VBA, the user will either have to put their macro settings on low (not recommended!), or they can have the security set to medium/high and you can attach a certificate to your code and have the user 'trust' macros from that source.  There was a question about this yesterday, see http:/Q_21859429.html for more details.

    There are ways of 'forcing' a user to enable macros for a workbook, only by hiding everything from the user if macros for that book are not enabled.  See for an example of this, though there are many more examples out there.  

    LVL 8

    Expert Comment

    why only mvidas??

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
    In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now