Making sure public VBA methods don't show up in the list of Excel macros

Add the following to the top of your module:

Option Private Module

From MSDN:

When a module contains Option Private Module, the public parts, for example, variables, objects, and user-defined types declared at module level, are still available within the project containing the module, but they are not available to other applications or projects.


One solution is to give the method an Optional argument.

Public Sub myPublicSub(Optional dummy_var As Integer)
    ...
End Sub

Just a small addendum to Jason Z's answer: methods hidden by Option Private Module are still visible if you use Application.Run() to invoke the method.

Tags:

Excel

Vba