View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default public const availability?

Not usually. You would need to set a reference from the workbooks that want
to use the constant to the workbook that defines the constant. Probably not
something you want to do.

A possible workaround could be:
In the workbook that contains the constant, you could put a sub that returns
its value

In a general module a workbook named ABC.xls as an example.

Public Const MyVal as Long = 10

Pubic Function ReturnMyVal()
ReturnMyVal = MyVal
End Function

then in the other workbook

v = Application.Run( "ABC.xl1!ABC")
msgbox v

now v will hold the value of the constant.
--
Regards,
Tom Ogilvy



"lcoreyl" wrote in
message ...

Using Excel VBA can a constant be available to multiple projects?


--
lcoreyl
------------------------------------------------------------------------
lcoreyl's Profile:

http://www.excelforum.com/member.php...fo&userid=2042
View this thread: http://www.excelforum.com/showthread...hreadid=552950