MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Feb 16th, 2002, 11:01 AM   #1
viper
Board Regular
 
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
Default

I know I've seen the code on here before but I cannot find it now. I am looking for a way to turn off the users macro in their tools menu when my spreadsheet is opened. How is this done?

Thanks,
viper is offline   Reply With Quote
Old Feb 16th, 2002, 11:39 AM   #2
keithkemble
Board Regular
 
Join Date: Feb 2002
Location: Leicestershire, U K
Posts: 157
Default

I don't think you can.
You can hide the code and stop access of the code if a Macro bombs out by going to vba editor ( alt F11) selecting Tools/properties
select protection tab and enter a password.

when you next load up the model users will be able to run macros but will not be able to alter anything.
keithkemble is offline   Reply With Quote
Old Feb 16th, 2002, 12:01 PM   #3
viper
Board Regular
 
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
Default

Thanks,

I don't know how it's done, but on my work computer, we don't have access to macros at all, I'm assuming that you can make macros unavailable to users when users starts up but maybe not just individual workbooks. But you're right. I did password my project, but I just want to make double sure my macros are protected from manipulating sources.

Thanks again,
viper
viper is offline   Reply With Quote
Old Feb 17th, 2002, 08:32 PM   #4
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-02-16 10:39, keithkemble wrote:
I don't think you can.
You can hide the code and stop access of the code if a Macro bombs out by going to vba editor ( alt F11) selecting Tools/properties
select protection tab and enter a password.
You can actually disable these controls
like so........

Dim CB As CommandBar
Dim C As CommandBarControl
Dim ID

Sub Disable_RightClick_ToolBar()
ID = 30017
For Each CB In Application.CommandBars
Set C = CB.FindControl(ID:=ID, recursive:=True)
If Not C Is Nothing Then C.Enabled = False
Next
Application.CommandBars("toolbar list").Enabled = False
Application.CommandBars("Visual Basic").Enabled = False
End Sub

Sub Enable_RightClick_ToolBar()

ID = 30017
For Each CB In Application.CommandBars
Set C = CB.FindControl(ID:=ID, recursive:=True)
If Not C Is Nothing Then C.Enabled = True
Next

Application.CommandBars("Toolbar List").Enabled = True
Application.CommandBars("Visual Basic").Enabled = True

End Sub



or something along these lines.....don't think I captured all of it...


Ivan
Ivan F Moala is offline   Reply With Quote
Old Feb 17th, 2002, 09:10 PM   #5
RWinfield
New Member
 
Join Date: Feb 2002
Location: Washington State
Posts: 33
Default

Right click on the excel icon next to FILE on the toolbar choose VIEW CODE and paste the following code into the workbook module.

Private Sub Workbook_Open()
Application.CommandBars("Tools").Controls(11).Enabled = False
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("Tools").Controls(11).Enabled = True
End Sub

This will gray out the Macro choice on the Tools menu as the workbook is opened, and will return it after the workbook is closed.

This will not prevent all access to the macro, but is kind of like a padlock...Keeps honest people honest, but doesn't really stop anyone with a bit of dedication

Rick
RWinfield is offline   Reply With Quote
Old Feb 17th, 2002, 09:18 PM   #6
viper
Board Regular
 
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
Default

Rick,
Thanks. But a question? Does it only work on other computers? I pasted it as you stated and then saved and reopened but didn't gray out my macros.
viper is offline   Reply With Quote
Old Feb 17th, 2002, 09:26 PM   #7
RWinfield
New Member
 
Join Date: Feb 2002
Location: Washington State
Posts: 33
Default

Interesting because it works fine here. Did you save the changes to the workbook when you saved it? I pasted the two macros into a new workbook, closed the workbook and answered YES to the save changes prompt, and then reopened the workbook. The macro choice on the tool menu is grayed out on mine.

Rick
RWinfield is offline   Reply With Quote
Old Feb 17th, 2002, 10:33 PM   #8
viper
Board Regular
 
Join Date: Feb 2002
Location: Jefferson City, Missouri
Posts: 383
Default

I just tried it on a second copy of the file and it didn't work either. But thanks, I will work with it and get it working. At least I know it can be done and that makes this project a little bit safer.

Again thanks,
viper is offline   Reply With Quote
Old Feb 17th, 2002, 10:39 PM   #9
RWinfield
New Member
 
Join Date: Feb 2002
Location: Washington State
Posts: 33
Default

Quote:
On 2002-02-17 21:33, viper wrote:
I just tried it on a second copy of the file and it didn't work either. But thanks, I will work with it and get it working. At least I know it can be done and that makes this project a little bit safer.

Again thanks,
The only thing I can think of is possibly we are using different versions of Excel. I am using Excel 2000 on Win98. Hope you get it sorted out.

Rick
RWinfield is offline   Reply With Quote
Old Feb 17th, 2002, 11:18 PM   #10
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-02-17 21:39, RWinfield wrote:
Quote:
On 2002-02-17 21:33, viper wrote:
I just tried it on a second copy of the file and it didn't work either. But thanks, I will work with it and get it working. At least I know it can be done and that makes this project a little bit safer.

Again thanks,
The only thing I can think of is possibly we are using different versions of Excel. I am using Excel 2000 on Win98. Hope you get it sorted out.

Rick
Your code uses and index = 11 = 11th item
on the tool list....if there are any other
items on this list that are NOT std then
it will grey out the 11 item weather that is
the macro button or not......thats why I
used the command ID number in my code posted earlier.


Ivan
Ivan F Moala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes