View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default Scope of variable includes all Form _and_ Code modules??

A publicly declared variable in a class module is also available to the
other modules as long as you precede it by the class name.

For instance, declare a public variable cWorksheets in ThisWorkbook module,
and form anywhere else you can reference it with this code

Thisworkbook.cWorksheets=17

same with Forms, Worksheets.

--

HTH

Bob Phillips

"kiat" wrote in message
...
Yes, it's possible. Simply declare them variables in a module using Public
keyword, Public p_i As Long, Public p_Const As String = "This is a

string."


"John Wirt" wrote in message
...
Is it possible to declare a public variable so that it is within scope

for
all Form and Code modules?

Thanks.

John Wirt