![]() |
Option Private Module
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? |
Option Private Module
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) "Smallweed" wrote in message ... 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? |
Option Private Module
Thanks Bob
|
Option Private Module
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) "Bob Phillips" wrote in message ... 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) "Smallweed" wrote in message ... 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? |
All times are GMT +1. The time now is 02:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com