This problem is actually in Word, not Excel. But I thought someone might still be able to help.
On the form I'm working on, at the bottom I have 2 commandbuttons and 2 texboxes. The command buttons serve as a digital signature of sorts. The goalstate is that when you click commandbutton1 it drops the following in Textbox1 (TextBox1.Value = (Environ("username") & " - " & Now())).
Commandbutton1 and Textbox1 are designated for managers only.
Commandabutton11 and Textbox11 are designated for non-managers only.
I need something built in to make sure each party can't use the other party's buttons. (i.e. For the manager button, if (Environ("username") = one of the 6 mgr id's then allow the click. If (Environ("username") <> one of the 6 mgr id's then pop up a msgbox stating access is not allowed).
There are only 6 managers, so I tried to write the code as such, and it apparently does not work. Remember this WORD I'm trying to do this in, not Excel.
On the form I'm working on, at the bottom I have 2 commandbuttons and 2 texboxes. The command buttons serve as a digital signature of sorts. The goalstate is that when you click commandbutton1 it drops the following in Textbox1 (TextBox1.Value = (Environ("username") & " - " & Now())).
Commandbutton1 and Textbox1 are designated for managers only.
Commandabutton11 and Textbox11 are designated for non-managers only.
I need something built in to make sure each party can't use the other party's buttons. (i.e. For the manager button, if (Environ("username") = one of the 6 mgr id's then allow the click. If (Environ("username") <> one of the 6 mgr id's then pop up a msgbox stating access is not allowed).
There are only 6 managers, so I tried to write the code as such, and it apparently does not work. Remember this WORD I'm trying to do this in, not Excel.
Private Sub CommandButton1_Click()
If Environ("username") = "brookss1" Or Environ("username") = "HURLEYM1" Or Environ("username") = "innamoj" Or Environ("username") = "meyersl" Or Environ("username") = "rideoum" Or Environ("username") = "tomling2" Then
TextBox1.Value = (Environ("username") & " - " & Now())
End If
If Environ("username") <> "brookss1" Or Environ("username") <> "HURLEYM1" Or Environ("username") <> "innamoj" Or Environ("username") <> "meyersl" Or Environ("username") <> "rideoum" Or Environ("username") <> "tomling2" Then
MsgBox ("You are not authorized to perform this function")
End If
End Sub