Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding and Showing Sheets using Macro engbe Excel Discussion (Misc queries) 3 May 12th 08 05:14 AM
Trouble Using InputBox Method to Select Range from Other Sheets pao_e_vinho[_4_] Excel Programming 0 June 23rd 06 11:48 AM
Is there any way to switch among different sheets in a workbook while an inputbox is popped? lvcha.gouqizi Excel Programming 1 November 1st 05 09:00 PM
Auto_Open/Workbook_Open subroutines showing SCREENUPDATING WhytheQ Excel Programming 2 July 5th 05 03:50 PM
Define array of sheets by inputbox Herman[_4_] Excel Programming 2 January 28th 05 02:25 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"