LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Declaring Variables Public


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring variables in Module vs. Public Jeff Excel Discussion (Misc queries) 5 November 19th 07 08:27 PM
declaring a public array JT[_2_] Excel Programming 3 July 27th 04 11:18 PM
Declaring Public Procedure mac Excel Programming 3 December 3rd 03 05:01 PM
Declaring Variables Robert[_16_] Excel Programming 2 November 20th 03 04:16 PM
Declaring Variables chris brunt Excel Programming 2 August 4th 03 02:02 PM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"