Userform Code vs Module Code

Userform Code vs Module Code

Anonymous
Not applicable
552 Views
1 Reply
Message 1 of 2

Userform Code vs Module Code

Anonymous
Not applicable
I am pretty new to VBA, and am trying to wrap my head around the whole concept of userform vs module coding

I have created a userform and coded the relative userform events. I have also created a module, and called a procedure to initialise the userform. Within this module, i have additional sub procedures for data processing.

I would prefer to code in separate modules, and have them referenced by the main userform, however, I notice that when I go to run the macro, I get the option of running all the procedures (if they are declared public). When I change the sub procedures to 'Private', they cannot be reference from the userform code.

Am I missing something here?
Is it possible to have multiple sub procedures and modules within a program that are not contained within the userform code module, and are also hidden from the end user when they run the macro from the Visual Basic Manager?

Thanks in advance

AM
0 Likes
553 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
You might declare them as "Public Function" in the module.
They can be referenced from your userform, while the end user will never see them from VBA Manager or "Alt+F8"
0 Likes