Option Private Module

S

Smallweed

I'm a bit confused: I want to put Option Private Module at the top of all
modules in my addin that contain UDFs because I don't want them appearing in
the function wizard. However, is this going to affect my being able to
access routines in my addin from elsewhere?

VBA help says "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." I was worried
this would stop me being able to use code like the following from other
projects:

Application.Run ("myAddin.xla!myMacro", arg1, arg2)

This still appears to run fine, despite having Option Private Module at the
top of the module containing myMacro.

What then are the ramifications of putting Option Private Module at the top
of every module in my addin? Am I going to have any problems with
pre-existing code in other workbooks that refer to my addin code?
 
B

Bob Phillips

The procedures are just not exposed through the object model to other
projects. As you have found Application.Run bypasses this, as it already
knows where the procedure is, so it has no need to look in the library.

Should be okay as long as you never want to use them directly.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
C

Chip Pearson

The procedures are just not exposed through the object model to other
projects.

That's actually a description of Friend scope, not Private scope.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top