Disable buttons in Macro

Closed
Ron - Feb 5, 2009 at 09:37 AM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Jun 21, 2010 at 03:02 PM
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
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..
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
Jun 21, 2010 at 03:02 PM
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
0