Posted to microsoft.public.excel.programming
|
|
Password Protect Indicators
Greetings / Goede Morgen
I'm at your mercy. I've checked and rechecked the spelling, etc.
and still cannot get the sheets protection part to work.
Would you kindly help me out?
Thanks
"keepITcool" wrote:
yes it works with the standard "Protection" toolbar
(since xlXP?) and yes it must be visible. my code assumes
it's a standard non modified "protection" toolbar, where the
"worksheet/workbook icons are #3 and #4..)
else include a line cbr.visible=true in the updateTB macro.
normally the xla will load, the workbook_open event is autom. fired
and you're fine.
however: during testing/ building you must be sure that the xlApp
variable is set. this is easiest done by running the workbook_open
procedure from the VBE (with f5 while cursor is inside the procedure)
When the alApp is set ( Not nothing) it will monitor specified events
in the running instance of excel. This means it can react to
any workbook being activated of any selection change in all worksheets
in any open workbook.
it will call updateTB.
Update TB toggles the icons for the worksheet/workbook icons on the
toolbar.
--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam
BEEJAY wrote :
Thank You, keepITcool
Copied into Thisworkbook module.
Saved as .XLA
"selected" the add-in.
1: I have no idea what the following means:
Would you be so kind as to step me thru it?
to test make sure you fire up the workbook_open procedure
to instantiate the xlApp variable (and thus it's evetns)
2: Does the macro call up the Standard Protection Bar?
Or does it have to be open already?
Or does it create its own toolbar?
Sorry for the bother. My application ideas far out-stretch my
capabilites, although I am learning (slowly).
"keepITcool" wrote:
in xl2003 you have a STANDARD protection bar.
use it..
put this in Thisworkbook module of an addin
(or any workbook you autoload)
it has an application level evetn handler.
to test make sure you fire up the workbook_open procedure
to instantiate the xlApp variable (and thus it's evetns)
Option Explicit
Dim WithEvents xlApp As Application
Private Sub Workbook_Open()
Set xlApp = Application
End Sub
Private Sub xlApp_SheetActivate(ByVal Sh As Object)
UpdateTB
End Sub
Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Range)
UpdateTB
End Sub
Sub UpdateTB()
Static cbr As CommandBar, ctlWKS As CommandBarButton, ctlWKB As
CommandBarButton
If cbr Is Nothing Then
Set cbr = Application.CommandBars("Protection")
Set ctlWKS = cbr.Controls(3)
Set ctlWKB = cbr.Controls(4)
End If
On Error Resume Next
ctlWKS.FaceId = IIf(ActiveSheet.ProtectContents, 351, 893)
ctlWKB.FaceId = IIf(ActiveWorkbook.ProtectStructure Or
ActiveWorkbook.ProtectWindows, 352, 894)
End Sub
--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam
BEEJAY wrote :
Sorry, I should have specified.
I use Excel 2003.
I have the appropriate tool-bar icons open all the time.
The only way to "read" them is to put the cursor on them.
I'm looking for a "visual" read of the worksheet and workbook
status. I'm sure it must be possible.
Being a beginner, I just don't know where even to start.
thanks
"Bob Phillips" wrote:
Not so good if he still has 2000 or earlier.
--
HTH
Bob Phillips
"keepITcool" wrote in message
ft.com...
tried the protection toolbar?
--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam
BEEJAY wrote :
Greetings:
I am constantly protecting and unprotecting worksheets and
workbooks. This was driving me totally nuts, so I made up
(with major input from user group) protect/unprotect
toolbar icons and put them in a custom tool bar.
Now I'm looking for a quick, easy to read visual aid to
indicate: A: password protect status of current (active)
worksheet B: Password protect status of current (active)
Workbook
What I'm thinking is perhaps toolbar icons that changes
colour, or changes from blank to an "L" to indicate
locked, or ..................... ??
The indicators should work (be active) on whichever
workbook/worksheet is currently active.
I hope my question is clear.
Hopefully someone can help me out, before I'm totally bald.
|