0

I have an application with two sheets. The First is a LOGIN sheet where users can login to have access to the second sheet : the Working Sheet. At the start of the application, i have the Working Sheet set to xlSheetHidden in the sub Workbook_Open(), keeping the LOGIN sheet always visible. Only when the user Login with correct name and pw that the Working sheet is set to xlSheetVisible from the Login Sub. My trouble is that when i save and close the application while the Working Sheet is active, at the next start of the application , the Working Sheet appears a fraction of second before been set to xlSheetHidden and disappearing. This is not very comfortable and i would like to avoid it. The Sub code as follow:

Private Sub Workbook_Open()
   
    Application.ScreenUpdating = False

    Worksheets("Working Sheet").Visible = xlSheetHidden
    
    Application.ScreenUpdating = True

End Sub

I have tried to activate the LOGIN sheet before closing the application so that at the next start the working sheet won't appear but it doesn't work. I tried that same activation code within the Workbook_Open() sub but the codes in that sub execute after to showing and disappearance of the working sheet at the start of the application. I would appreciate if i could have an answer to this here.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    
    Worksheets("LOGIN").Activate

End Sub

1 Answers1

0

Why not have two different workbooks. The first looks after the login. The second is your real data and is password protected. The login workbook does the user validation and then opens the real data workbook.

Senior Momentum
  • 186
  • 1
  • 5
  • Yes that is an option but i have other interactions between the LOGIN and the working sheets, and that architecture has been chosen since day 1. So difficult to step back. – J-Pierre Avognon Dec 05 '22 at 14:41