Happy rainy Monday!
I have the following code to run macros based on the user's name. By stepping through the Workbook_Open code on a couple machines with different users I have verified that it's not detecting the user's name at all. I'm not getting any errors but I must be doing something wrong. If it matters, all users are using Windows 10 Pro. Here's the code (All names have been changed to protect the innocent):
I have the following code to run macros based on the user's name. By stepping through the Workbook_Open code on a couple machines with different users I have verified that it's not detecting the user's name at all. I'm not getting any errors but I must be doing something wrong. If it matters, all users are using Windows 10 Pro. Here's the code (All names have been changed to protect the innocent):
VBA Code:
Private Sub Workbook_Open()
Application.Calculation = xlAutomatic
Call SortByDate
If Environ("username") = "User1" Then
Call ViewJP
Application.MoveAfterReturnDirection = xlToRight
GoTo SkipDashboard
ElseIf Environ("username") = "User2" Then
Call ViewALR
Application.MoveAfterReturnDirection = xlToRight
GoTo SkipDashboard
ElseIf Environ("username") = "User3" Then
Call ViewALR
Application.MoveAfterReturnDirection = xlToRight
GoTo SkipDashboard
ElseIf Environ("username") = "User4" Then
Call ViewALR
Application.MoveAfterReturnDirection = xlDown
GoTo SkipDashboard
ElseIf Environ("username") = "User5" Then
Call ViewALR
Application.MoveAfterReturnDirection = xlToRight
GoTo SkipDashboard
End If
Call OpenDashboard
SkipDashboard:
End Sub