Quote:
Originally Posted by gmaxey
The public variable needs to be a standard module. You can set it use Document_Open in the ThisDocument module or you could set it using AutoOpen in the same standard module. You don't need Static anywhere.
|
If I want this in a global template, what sets the variable's value? That is where I was going with
Static AutoExec. Perhaps the AutoExec will do it without the Static so long as the variable is set as public in the class module.
With
Code:
Public strTest as String
in the ThisDocument Module
The following macro in a standard module in the same template generates a Variable not defined error. This is true even though the editor will correct the case of the variable name if typed in all lower case.
Code:
Sub AutoExec()
Let strTest = "This is a test"
MsgBox strTest
End Sub
This also generated an error in hidden module when I attempted to load it as an Add-In.