Hide A Macro

You can hide macros so that they do not appear on the Macro dialog box in Excel. If you create workbooks that you intend to share with other users, you may find that you want to hide specific macros within your workbook. This can help to ensure that an unknowing user does not inadvertently delete the macro from your workbook.

Because Excel cannot execute a hidden macro from the Macro dialog box, the only method of execution for a hidden macro involves assigning a toolbar button or menu option. When you hide a macro, shortcut keys no longer execute the macro. If you do not assign the macro to a toolbar button or menu option, Excel cannot execute the macro.

If you want to hide a macro, you need to open the module containing the corresponding macro within the Visual Basic

Editor and place the Private statement in front of the Sub statement for the subroutine. For example, you type the following to hide a ChangeText subroutine: Private Sub ChangeText().

Keep in mind that hiding a macro does not prevent users from viewing or modifying it in the Visual Basic Editor. If you want to keep another user from accessing the macro, you need to lock the project containing the macro by changing the properties of the project. See the section "Set Properties for a Project" for more details on specifying the project properties. Locking the project prevents a user from viewing and modifying all the VBA code within that project in the Visual Basics Editor. To open the project, the user must specify the correct password. Although locking a project prevents user accessiblity, Excel can still execute any macros within the project.

HIDE A MACRO

HIDE A MACRO

—D Click Tools O Macro O Macros.

0 Click the macro that you want to hide.

L-H Click Edit.

—D Click Tools O Macro O Macros.

0 Click the macro that you want to hide.

L-H Click Edit.

0 0

Post a comment