I have a password authentication step when anyone opens the workbook. I have multiple users who will be accessing this workbook and based on that i have assigned a variable called user to identify who amongst them is using it.
Public pwd, user As String
Public graccess As Integer
Private Sub workbook_open()
graccess = 0
Do
pwd = InputBox("Please provide your password", "Authentication")
If pwd = "access" Then
user = "GTS"
graccess = 1
ElseIf pwd = "enter" Then
user = "AP"
graccess = 1
Else
MsgBox ("failed to authenticate")
pwd = ""
graccess = 0
End If
Loop Until graccess = 1
End Sub
Now when this user starts working on the excel sheet i need to check the user variable to check which user is accessing the sheet. Since this code will now come in the *worksheet_change* event it is a different sub routine which will be run after the previous code has finished running and is out of use.
so my questions are am i not able to see the user in the variable because my workbook_open event is over and the code has stopped running? what can i do to make sure the variable does not lose its value?
thanks for the patience :)