How to make a public routine for all forms without being attached to a form?

0

I have several forms in my application, and I can initiate the call by some of them in partial execution for tests (not necessarily START by main form).

In addition to the public variables that are in a module, I tried to do the same with routines and public functions, so that they would not be scattered in codes of several forms or concentrated in one, because in any of these cases the partial call of the application would load all the functions and routines that could be requested.

Can you do this?

For example, I want a public routine that places the default values in public variables, but not in a form code.

     Public Sub InicializaVariaveisPublicas()

     VersaoATual = "2.03.017"

     QuantidadeMaximaProjetos = 2

     QuantidadeMaximaItens = 10

     ArrastoMouse = False

     MaximoTentativas = 3

     ...

     ...

     End Sub

SOLUTION

See the answer below

    
asked by anonymous 12.12.2015 / 19:58

1 answer

1

ERROR FOUND

The error was by distraction, I was calling the routine with parentheses to put two arguments: Routine (a, b) , just take them out and worked, even being the first call of Form_Activate, Rout a, b .

Just do the routines and public functions in a single "module" that works .

In my case I have three modules, one for public variables, one for routines and public functions, and one for Excel macros.

    
12.12.2015 / 22:27