Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto_open inputbox before showing the sheets
Hello,
I would like to create a following functionality to my workbook. When the user opens the Excel file he sees only inputbox for password but not the contens of the activesheet in the Excel file. I have the following code: Private Sub auto_open() Dim answer As String answer = InputBox("Insert password") If answer = "abc" Then Sheets("Sheet1").Activate Else ActiveWorkbook.Close End If End Sub However, the problem is that now Excel already shows the information in the active sheet and I would like to prevent this. Any ideas how to do this? Best regards Vepa |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto_open inputbox before showing the sheets
Try this:
Private Sub auto_open() Dim answer As String Application.Visible = False answer = InputBox("Insert password") If answer = "abc" Then Sheets("Sheet1").Activate Application.Visible = True Else Application.Visible = True ActiveWorkbook.Close End If End Sub However, this is far from foolproof. All the user has to do is disable macros before opening the workbook. There is not much security in Excel once the user has the workbook open. Why not save the workbook with a password required to open it? Hope this helps, Hutch "Vepa" wrote: Hello, I would like to create a following functionality to my workbook. When the user opens the Excel file he sees only inputbox for password but not the contens of the activesheet in the Excel file. I have the following code: Private Sub auto_open() Dim answer As String answer = InputBox("Insert password") If answer = "abc" Then Sheets("Sheet1").Activate Else ActiveWorkbook.Close End If End Sub However, the problem is that now Excel already shows the information in the active sheet and I would like to prevent this. Any ideas how to do this? Best regards Vepa |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Hiding and Showing Sheets using Macro | Excel Discussion (Misc queries) | |||
Trouble Using InputBox Method to Select Range from Other Sheets | Excel Programming | |||
Is there any way to switch among different sheets in a workbook while an inputbox is popped? | Excel Programming | |||
Auto_Open/Workbook_Open subroutines showing SCREENUPDATING | Excel Programming | |||
Define array of sheets by inputbox | Excel Programming |