ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Private Sub - Only Accessible from same Module? (https://www.excelbanter.com/excel-discussion-misc-queries/194016-private-sub-only-accessible-same-module.html)

pallaver

Private Sub - Only Accessible from same Module?
 
This is more a confirmation than a question....

If I have a Public Sub that calls on another Sub which is Private, if
the Private Sub is not in the Module then an error appears.

My question then is why doesn't excel2003 allow for cross-module
Private Subs to be called upon?

It seems to me like it makes sense to give a private sub it's only
individual Module so that you can easily work on whichever sub you
want to. What's the reason, if any, for this type of setup?

Thanks, Neil

Dave Peterson

Private Sub - Only Accessible from same Module?
 
What do want the word Private to mean instead?

If you want to call a sub from a different module, why not make the sub public?

If you absolutely have to keep your private and you absolutely have to call it
from a different module, then you could use application.run.




pallaver wrote:

This is more a confirmation than a question....

If I have a Public Sub that calls on another Sub which is Private, if
the Private Sub is not in the Module then an error appears.

My question then is why doesn't excel2003 allow for cross-module
Private Subs to be called upon?

It seems to me like it makes sense to give a private sub it's only
individual Module so that you can easily work on whichever sub you
want to. What's the reason, if any, for this type of setup?

Thanks, Neil


--

Dave Peterson


All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com