Prevent Username Accessing Workbook

  • Thread starter Martin Whitehead
  • 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.
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top