Disable buttons in Macro [Closed]

Report
-
Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
-
Hello,

I want to know how to disable the buttons or grey them out in the macro window, when we click on Tools > Macro > macros > we get the window where we can see the buttons on the right side which is Run, Cancel, Step into,Edit,Create,Delete,Options. After creating macro I would not like others to see the code coz there are chances that they might make some changes. I would like to have only Run and Cancel buttons enabled. It is possible because I have a spreadsheet created by an unknown person who has done this. Can someone help me!

Regards,
Ron

2 replies

While in the Visual Basic Editor, Click Tools -- VBA Project Properties.
In the General tab type a name for your project.
Now click the Protection tab.
Click the Lock project for viewing box.
Next, type a password in the box.
Type it again to confirm.
Click OK.

Save your excel file and close it.
Reopen your excel file and go to Tools -- Macros.
It will be greyed out as you desired.
Now go to the Visual Basic Editor and double click your project.
It will prompt you for a password.
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 3393 users have said thank you to us this month

I tried with the above given instructions in word, but I didn't see disabled button.. It is still enable but prompting for password..

Any one can help on this please..
Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
758
I am not sure if thats possible. If you dont want the user to modify the code, then protect you VBA project with password. In this way macro can still run and no one can modify the code