LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA Question: Getting values from hidden sheets


I'm trying to write a Template that has a splash screen as only
visible worksheet at the start and then unhides the other sheets based
on the user's access level

Admin unhides all sheets
R/W unhides all but the special sheets used for the macros
R/O unhides all but the special sheets used for the macros
None. nothing but splash screen

The code below works well for all access levels in Excel 2002.
In Excel 2000, it doesn't perform consistently. When I open the file
I get the MsgBox welcoming me, but nothing else happens. Next try, I
hit Ctrl-Break at the message box and entered debugger. The code
would run to the line tagged as having an error and stop (so we have
original configuration with only Splash screen visible). Here's the
weird part. If I were to run the Workbook_Open macro manually at this
point, the macro runs without a hitch.

The Active_Sheet range is located on a hidden sheet. My initial
thought was that Excel 2000 was having problem getting value fro
hidden sheet but that doesn't explain why the code runs without error
when run manually.

Any suggestions?

Terry Detrie


Private Sub Workbook_Open()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Initialize = True
Restrict = Range("Restrict").Value
Access = Range("Access").Value

If (Restrict Or Access = "R/O") And ActiveWorkbook.ReadOnly =
False Then
ActiveWorkbook.ChangeFileAccess Mode:=xlReadOnly
ElseIf Restrict = False And ActiveWorkbook.ReadOnly Then
ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite
End If

If Access = "None" Then
MsgBox "You are not listed as a registered user."
Else
MsgBox "Welcome! Resetting pages now"

For Each Sh In ThisWorkbook.Worksheets
Range("Active_Sheet").Value = Sh.Name ' ERROR 1004
PassWd = Sheets("Sheets").Cells(2, 5).Value
If IsError(PassWd) Or Access = "Admin" Then
Sh.Visible = xlSheetVisible
Else
Sh.Visible = xlSheetVeryHidden
If PassWd < "0" Then
Sh.Protect Password:=PassWd,
Userinterfaceonly:=True
End If
End If
Next Sh
End If

Initialize = False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

 
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
hidden sheets Soccerboy83 Excel Discussion (Misc queries) 5 November 25th 09 06:17 PM
Count Unique Values but not Filtered or Hidden Values Lee Excel Worksheet Functions 3 June 2nd 09 11:18 PM
Hidden Sheets QUESTION-MARK Excel Worksheet Functions 4 May 19th 06 07:06 PM
Help! Calling hidden sheets? A.W.J. Ales Excel Programming 0 February 5th 04 07:09 PM
Help! Calling hidden sheets? Ron de Bruin Excel Programming 0 February 5th 04 07:02 PM


All times are GMT +1. The time now is 11:21 PM.

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"