PC Review


Reply
Thread Tools Rate Thread

Auto_open inputbox before showing the sheets

 
 
Vepa
Guest
Posts: n/a
 
      11th Dec 2008
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 With Quote
 
 
 
 
Tom Hutchins
Guest
Posts: n/a
 
      11th Dec 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Using InputBox Method to Select Range from Other Sheets pao_e_vinho Microsoft Excel Programming 0 23rd Jun 2006 11:48 AM
Is there any way to switch among different sheets in a workbook while an inputbox is popped? lvcha.gouqizi Microsoft Excel Programming 1 1st Nov 2005 09:00 PM
Auto_Open/Workbook_Open subroutines showing SCREENUPDATING WhytheQ Microsoft Excel Programming 2 5th Jul 2005 03:50 PM
Define array of sheets by inputbox Herman Microsoft Excel Programming 2 28th Jan 2005 02:25 AM
Sheets not showing =?Utf-8?B?TWF1cmljaW8gU2lsdmE=?= Microsoft Excel Misc 1 29th Oct 2004 08:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.