Good afternoon,
I am working in an Excel workbook, of which should maybe be an Access DB, but my supervisor started with Excel and I'm helping him see how far we can push the envelope in Excel. I'm not sure he knows this.
I have used the term Environ$("username") in Access to secure and allow only users with the proper access to a form/report, etc. by using an IF, THEN, ELSE statement which checks their logged on USERNAME before going to the form/report, etc.
I have an Autpen macro which populates cell B1 on the Main worksheet with the users "username". On the Main worksheet I have buttons that go to other pages in the workbook. By using the code below I want to restrict users depending on their "username" from going to certain worksheets. Sure this uses the term "security" lightly, but I feel it will get the job done and with other measures I'm taking, should serve the purpose. Let me know what you got. Much appreciated!
----------------------------------------------------------
Sub Button3_Click()
' Dim myRange As Range
' Set myRange = Worksheets("Main").Range("B1")
If Range("B1").Value = "SI5K" Then
Sheets("Beth").Select
Else
MsgBox "You do not have access to this page", vbCritical, "Access Denied"
End If
End Sub
I am working in an Excel workbook, of which should maybe be an Access DB, but my supervisor started with Excel and I'm helping him see how far we can push the envelope in Excel. I'm not sure he knows this.
I have used the term Environ$("username") in Access to secure and allow only users with the proper access to a form/report, etc. by using an IF, THEN, ELSE statement which checks their logged on USERNAME before going to the form/report, etc.
I have an Autpen macro which populates cell B1 on the Main worksheet with the users "username". On the Main worksheet I have buttons that go to other pages in the workbook. By using the code below I want to restrict users depending on their "username" from going to certain worksheets. Sure this uses the term "security" lightly, but I feel it will get the job done and with other measures I'm taking, should serve the purpose. Let me know what you got. Much appreciated!
----------------------------------------------------------
Sub Button3_Click()
' Dim myRange As Range
' Set myRange = Worksheets("Main").Range("B1")
If Range("B1").Value = "SI5K" Then
Sheets("Beth").Select
Else
MsgBox "You do not have access to this page", vbCritical, "Access Denied"
End If
End Sub