Prevent Username Accessing Workbook

  • Thread starter Thread starter Martin Whitehead
  • Start date Start date
M

Martin Whitehead

I have a shared workbook which is used by several people. I would like to
prevent one particular username (the one set it Excel properties) from
accessing the workbook.

Any help with this would be appreciated.
 
Not resilient, but maybe good enough

'-----------------------------------------------------------------
Private Sub Workbook_Open()
'-----------------------------------------------------------------
If Application.UserName = "Joe" Then
Me.Close False
End If
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Back
Top