Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

global constants in a module 1

Status
Not open for further replies.

OhioSteve

MIS
Mar 12, 2002
1,352
US
I have a module with several functions. I want to create some global constants that I can use in any of the functions. What is the syntax for that, assuming that my values are strings?
 
Public myVar As String

in the General Declarations section of the module.
 
Public Const cstString1 = "my first global string constant"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV, is there a way to declare it with an explicit type and set the value? The compiler won't let me type a second line to assign a value, so I guess I need to do everything on one line.
 
Oops, sorry for the partial reply:
Public Const cstString1 As String = "my first global string constant"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If the constants are only for use by the various functions within the module, then I would declare them:


[tt]Private Const cstString1 As String = "my first global string constant"
[/tt]


Hope this helps

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top