View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OJ[_2_] OJ[_2_] is offline
external usenet poster
 
Posts: 111
Default Limit access to certain worksheets (tabs)

Hi,
this is possible. One way is to use the Workbook_Open &
Workbook_BeforeClose events. Use the Before_Close event to hide all the
sheets, and the Workbook_Open Event to show the sheets based on
username.... Something like this should start you off...this will show
sheets 1 to 5 (regardless of whether they are chart sheets or
worksheets) to John Doe..

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim intCnt As Integer
For intCnt = 1 To Me.Sheets.Count
Me.Sheets(intCnt).Visible = xlSheetVeryHidden
Next intCnt
End Sub


Private Sub Workbook_Open()
Dim strUser As String, intCnt As Integer

Let strUser = Environ("UserName")

Select Case strUser
Case "Doe, John"
Me.Sheets(Array(1,2,3,4,5)).Visible = xlSheetVisible
Case "Smith, John"
'''....etc...
Case Else

End Select
End Sub


Hth,
OJ