![]() |
|
#1
|
||||
|
||||
![]() Quote:
Public userRole as String userRole can be cleared from any sub or function with code like: userRole = "" If you want to prevent userRole being reset use code like: Const userRole As String = "Manager" Note also that having: Option Explicit at the top of your code module will protect you from having something like: Public userRole as String but then referencing it as: useRole in your code - which quite understandably would come back as a null string.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks for the input on this.
It cannot be a constant, as it would be set by a user selection. This selection needs to be kept as long as the document is open (or another selection changes it). This initial value should be set as the beginning of the use of these scripts. A null value is expected to error check if other parts of the code is used out of turn, which direct the user to proper usage. So a global var is the only thing I can think of. Other parts of the process 'stamp' a value at the end of the document in a protected area, but as the role can be changed during the use of the document, and these stamps are there from the first usage of the code, I cannot rely on that as a reference point. It needs to be something set only after the code is started, and should have a null value before that. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How does the Enterprise Global and local Global an User Regitry work together? | Lupus74 | Project | 0 | 08-31-2018 12:18 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 |
![]() |
lefttoday | Word | 3 | 02-03-2011 03:34 PM |
![]() |
ryalls3857 | Word | 1 | 12-27-2010 05:45 PM |