[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 703
  • 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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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