Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is this the right syntax for declaring a variable to be public? This i what I found in the VB Help File. Public Statement Example This example uses the Public statement at the module level (Genera section) of a standard module to explicitly declare variables a public; that is, they are available to all procedures in all modules i all applications unless Option Private Module is in effect. Public Number As Integer ' Public Integer variable. But executing the following code code gives me the error "Invali Attribute in Sub or Function" occurring at the "Public mystr..." line. ______________________ Sub mysub1() Public mystr As String mystr = "hello world" End Sub ______________________ Also, I'm guessing mysub1() needs to be executed just once before thos strings are set in memory? Thanks, To -- ob3ron0 ----------------------------------------------------------------------- ob3ron02's Profile: http://www.excelforum.com/member.php...fo&userid=1545 View this thread: http://www.excelforum.com/showthread.php?threadid=27204 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Declaring variables in Module vs. Public | Excel Discussion (Misc queries) | |||
declaring a public array | Excel Programming | |||
Declaring Public Procedure | Excel Programming | |||
Declaring Variables | Excel Programming | |||
Declaring Variables | Excel Programming |