View Single Post
 
Old 11-22-2020, 11:20 PM
rekent rekent is offline Windows 10 Office 2016
Novice
 
Join Date: May 2014
Posts: 23
rekent is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
As a public variable, its value will persist but you do need to run the macro to give it a value first. So you should rename the setProjectPath macro to Document_Open or Document_New as these will autorun with either opening an existing document or creating a new document respectively.

Alternatively, you could declare it as a constant.
I tried the constant route, adding
Code:
Public Const projectPath As String = "myURL"
but I receive an error that says "Constants, fixed-length strings, arrays, user-defined types, and Declare statements not allowed as Public members of object modules."

For what it's worth, I also tried the two methods for Document variable, but they too ddi not seem to set/persist.
Reply With Quote