ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Prevent Username Accessing Workbook (https://www.excelbanter.com/setting-up-configuration-excel/81013-prevent-username-accessing-workbook.html)

Martin Whitehead

Prevent Username Accessing Workbook
 
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.




Bob Phillips

Prevent Username Accessing Workbook
 
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)

"Martin Whitehead" wrote in message
...
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.







All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com