Hi All:
I found this code to open workbook if only name Array the same Username of PC:
How to change Array("Username...") by list name A1:A10 in Sheet("Username")
Thanks./.
I found this code to open workbook if only name Array the same Username of PC:
Code:
Private Sub Workbook_Open()
Dim UserNames As Variant
UserNames = Array("Username1", "Username2", "Username3")
If Not IsNumeric(Application.Match(Application.UserName, UserNames, 0)) Then
MsgBox "You do not have permission to open this file"
ThisWorkbook.Close False
Else
MsgBox "Welcome " & Application.UserName & "."
End If
End Sub
Thanks./.
Last edited: