![]() |
|
|
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
Quote:
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 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. |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Combining 3 Modules into 1
|
Jude24Joy | Word VBA | 5 | 02-01-2017 04:20 PM |
Declaring a variable that is known across modules
|
Officer_Bierschnitt | Excel Programming | 5 | 11-18-2015 12:28 PM |
| Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
| can word: make variables, find appropriate pages, fill out pages with variables, print only those | 20GT | Word VBA | 1 | 10-15-2014 09:48 PM |
Empty Modules
|
Greg S. | Excel Programming | 2 | 07-30-2013 01:38 PM |