Excel password but cant hide the sheets before entering password

  • Thread starter Thread starter cakonopka
  • Start date Start date
C

cakonopka

Hi there all

I have made my system and i have a small password box on the firs
page, it is just using a password that is on a sheet, in the system,
want to know how i can hide all of the sheets until the right passwor
is entered and it takes me to my main menu sheet.

cheers

from C
 
you can try this:

Private Sub Workbook_Open()
ActiveWorkbook.IsAddin = True
If InputBox("Enter Password", "Enter Password") = "ThePassword" Then
'get password here - exit if not
ActiveWorkbook.IsAddin = False
Else
ThisWorkbook.Close savechanges:=False
End If
End Sub



If you are using Excel 97, this may create an application error, depending
on whatelse you do.

Also, if a user doesn't enable macros - workbook is open. You may want to
set the Isaddin property to true before distribution. If macros are not
enabled, the only way then to view the workbook would be to go into the VB
editor and set IsAddin = false, which most people won't know how to do. Of
course, you could also save the workbook with a password - and this would
solve this issue.

Ken V.
 
Back
Top