0

Is there a clever way of storing variables globally so that you can call them at any of the modules at anytime?

Example

Dim pwd As String pwd = "password" Private Sub Test() MsgBox (pwd) End Sub 

Thanks

2 Answers 2

2

Your example is a constant.

Public Const pwd as String = "password" 

Declare it on top of a standard module.

For other solutions with subs, functions or properties look at the Related-Section on the right side of the page.

Sign up to request clarification or add additional context in comments.

2 Comments

I intend to manipulate it in one or more of the functions in the module. Is constant viable?
@OdaySalim a constant is constant ;) Not changeable! I would suggest a property. See answer of Mathieu and have a look at the other related questions as I told you.
0

Global pwd As String

inside of a module-level module (not a sheet-level module).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.