VBA Trick of the Week :Keeping Macros Hidden from Users

Posted: July 3, 2013 by Transformer in Excel, VBA
Tags: , ,

When we press [Alt] + [F8], a macro explorer window is displayed, which lists all available macros (Public) in the current project even if the project is password protected. In this window, we can select any macro and can run/execute it. That might be undesirable sometimes.

Using Option Private Module at the top of a module prevents all macros of that module from being displayed in the macro list.


  Option Private Module
      Sub Test1()
      End Sub
      Sub Test2()
      End Sub

In the above example, procedures Test1 and Test2 will not be displayed in the macro explorer window because Option Private Module is written at the top of the module.

Basic use of  Option Private Module is to prevent macros and variables from being accessed by outside of the current projects. For more details http://msdn.microsoft.com/en-us/library/aa266185(v=vs.60).aspx

  1. […] VBA Trick of the Week :Keeping Macros Hidden from Users (usefulgyaan.wordpress.com) […]

Share your thoughts/feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s