News:

Happy New Year!

Main Menu

Run private sub from another module.

Started by Biomedmike, January 21, 2025, 12:44:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Biomedmike

Hi All, I wish to hide all my modules but they "Call" each other. Is it possible for VBA code to run a Private Sub from another sub?

Thank you,

BiomedMike

Surrogate

#1
Sorry, my mistake! We can run Private Sub only into same Module.


wapperdude

No.  And Yes....

As Surrogate indicates, a sub declared as Private cannot.  But...
1) remove the Private declaration from the sub
2) In the declaration region above that sub, enter Option Private Module. It is necessary to only do this once.  All subs in that module will be hidden, but will be accessible to code in other modules as if they weren't.  See  https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/option-private-statement
Visio 2019 Pro

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 183 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1065KB.
Tokens: post-login.
Cache hits: 14: 0.00227s for 26,551 bytes (show)
Cache misses: 4: (show)
Queries used: 19.

[Show Queries]