vba - Make a global variable in Visual Basic for Applications -


in vba access, how make global variable can access , change anywhere?

you can declare variable @ global scope declaring in standard module or predeclared class module such worksheet, userform or predeclared class, using public keyword:

public myvar string 

you can declare global variable using deprecated, still valid global syntax, functionally same public

global myvar string 

but note declaring variable public or global make variable accessible across entire project and project refers project, , if project protected, user still query variable immediate window.

if must have variable available across project, project, should declare variable in standard module, , include option private module statement make module private project, variables public project only.

option private module public myvar string 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -