View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Getting a constant/variable from another workbook?

Hi Gustaf,
If you place the declares at the top of a module they should be visible to any module/form. (public)

Option Explicit
Dim str1 as string, str2 as string, myPI as double...
str1="hello"
str2="Monday"
myPI=3.14285714285714

Sub firstsub()
....
end sub

John



"Gustaf" wrote in message ...
I need to get a value (a string constant) from another open workbook when Auto_Open() is run. Let's call them workbook 1 and 2.
When workbook 1 opens, and Auto_Open() is run, it should search workbook 2 for a constant/variable and set one of its own variables
to that value.

I've seen that this can be done in Word, using the Document.Variables collection, but I find nothing like that in the Workbook
model. Is there a way it can be done?

I know I can also save these values in the registry, but if there's a way to get them directly, that would be preferred.

Gustaf