• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 710
  • Last Modified:

disable the save and saveas button and Suppress Macro warning

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)?
0
howardching
Asked:
howardching
  • 2
1 Solution
 
hiteshgupta1Commented:
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

http://office.microsoft.com/en-us/assistance/HA011403071033.aspx
0
 
mvidasCommented:
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 http://vbaexpress.com/kb/getarticle.php?kb_id=578 for an example of this, though there are many more examples out there.  

Matt
0
 
hiteshgupta1Commented:
why only mvidas??
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now