IPasswords
Defines the public contract for the Passwords class, exposing workbook/worksheet protection management, key generation, debug-mode toggling, and import/export of password metadata. Uses TypeName dispatch to handle Workbook, Worksheet, and String target arguments through a single Protect/UnProtect entry point.
Core Accessors
PasswordSheet #
Worksheet hosting the password tables
Signature:
Public Property Get PasswordSheet() As Worksheet: End Property
Properties exposing the password worksheet and stored values.
Returns: Worksheet. The password worksheet.
Value #
Retrieve the value for a named tag
Signature:
Public Property Get Value(ByVal tagName As String) As String: End Property
Looks up the named range corresponding to the supplied tag label and returns its current value.
Parameters:
tagName: String. Supported tags: debuggingpassword, publickey, privatekey, version, labpublickey, labprivatekey.
Returns: String. The stored value.
DisplayPrompts #
Whether UI prompts are displayed during operations
Signature:
Public Property Get DisplayPrompts() As Boolean: End Property
Returns: Boolean. True when prompts are enabled.
DisplayPrompts #
Toggle UI prompt display
Signature:
Public Property Let DisplayPrompts(ByVal value As Boolean): End Property
Parameters:
value: Boolean. True to enable prompts.
LastPrivatePrompt #
Most recent private key prompt text
Signature:
Public Property Get LastPrivatePrompt() As String: End Property
Returns: String. The prompt text.
LastPrivatePromptTitle #
Most recent private key prompt title
Signature:
Public Property Get LastPrivatePromptTitle() As String: End Property
Returns: String. The prompt title.
TableRange #
Retrieve the range of a password-managed table
Signature:
Public Property Get TableRange(ByVal tableName As String, Optional ByVal includeHeaders As Boolean = False) As Range: End Property
Parameters:
tableName: String. Table identifier (T_keys or T_ProtectedSheets).includeHeaders: Boolean. When True, includes the header row. Defaults to False.
Returns: Range. The requested table range.
HasCheckings #
Whether any diagnostic entries have been captured
Signature:
Public Property Get HasCheckings() As Boolean: End Property
Returns: Boolean. True when at least one entry exists.
CheckingValues #
Retrieve the aggregated checking entries
Signature:
Public Property Get CheckingValues() As IChecking: End Property
Returns: IChecking. The checking object, or Nothing.
IsInDebugMode #
Whether the workbook is currently in debug mode
Signature:
Public Property Get IsInDebugMode() As Boolean: End Property
Returns: Boolean. True when debug mode is active.
Debug Mode
EnterDebugMode #
Put the workbook into a fully unprotected debug state
Signature:
Public Sub EnterDebugMode(Optional ByVal targetWorkbook As Workbook): End Sub
Toggle debug mode on the target workbook. Removes all worksheet and workbook protections and sets the debug mode flag. Defaults to the password workbook when no target is supplied.
Parameters:
targetWorkbook: Workbook. Optional target workbook.
LeaveDebugMode #
Restore protections after debug mode
Signature:
Public Sub LeaveDebugMode(Optional ByVal targetWorkbook As Workbook): End Sub
Reapplies worksheet-level protections from the protection matrix and re-locks the workbook structure.
Parameters:
targetWorkbook: Workbook. Optional target workbook.
EnsureDebugExitHandler #
Inject before-close procedures that leave debug mode automatically
Signature:
Public Sub EnsureDebugExitHandler(Optional ByVal targetWorkbook As Workbook):
Parameters:
targetWorkbook: Workbook. Optional target workbook.
Protection
Protect #
Protect a worksheet or workbook
Signature:
Public Sub Protect(Optional targetObject As Variant = "_active", _
Optional ByVal allowShapes As Boolean = True, _
Optional ByVal allowDeletingRows As Boolean = True, _
Optional ByVal registerState As Boolean = True)
Protect and unprotect worksheets and workbooks. Accepts a Workbook, Worksheet, or String. The string "_active" targets the active worksheet; "_wbactive" targets the active workbook.
Parameters:
targetObject: Variant. The object to protect. Defaults to "_active".allowShapes: Boolean. Allow manipulating drawing objects. Defaults to True.allowDeletingRows: Boolean. Allow deleting rows. Defaults to True.registerState: Boolean. When True, reuses stored table settings. Defaults to True.
UnProtect #
Remove protection from a worksheet or workbook
Signature:
Public Sub UnProtect(Optional targetObject As Variant = "_active")
Parameters:
targetObject: Variant. The object to unprotect. Defaults to "_active".
EnsureProtectedSheetsName #
Ensure the workbook exposes a named range referencing the protection table
Signature:
Public Sub EnsureProtectedSheetsName(Optional ByVal targetWorkbook As Workbook)
Parameters:
targetWorkbook: Workbook. Optional target workbook.
ApplyProtectionMatrix #
Apply stored protection settings to all listed worksheets
Signature:
Public Sub ApplyProtectionMatrix(ByVal wb As Workbook)
Parameters:
wb: Workbook. The workbook whose sheets to protect.
Keys
GenerateKey #
Randomly select a public/private key pair
Signature:
Public Sub GenerateKey(ByVal trads As ITranslationObject): End Sub
Key generation and display.
Parameters:
trads: ITranslationObject. Translation helper for prompts.
DisplayPrivateKey #
Display the current private key via a translated prompt
Signature:
Public Sub DisplayPrivateKey(ByVal trads As ITranslationObject): End Sub
Parameters:
trads: ITranslationObject. Translation helper for the message.
DataExchange
ExportToWorkbook #
Export the password worksheet into another workbook
Signature:
Public Sub ExportToWorkbook(ByVal wb As Workbook): End Sub
Import, export, and cloning operations.
Parameters:
wb: Workbook. Destination workbook.
ImportFrom #
Import keys and metadata from another password handler
Signature:
Public Sub ImportFrom(ByVal source As IPasswords)
Parameters:
source: IPasswords. Source password object.
CloneToWorksheet #
Clone the password worksheet into another sheet
Signature:
Public Function CloneToWorksheet(ByVal targetSheet As Worksheet) As IPasswords
Returns: IPasswords. Handler bound to the cloned sheet.
CloneToWorkbook #
Clone the password worksheet into another workbook
Signature:
Public Function CloneToWorkbook(ByVal wb As Workbook) As IPasswords
Exports the password data to the target workbook and returns a new handler bound to the cloned sheet. The new workbook receives keys, protection table, and a debug mode exit handler.
Parameters:
wb: Workbook. Destination workbook.
Returns: IPasswords. Handler bound to the cloned sheet.
Utilities
NewDebugingPassword #
Update the debugging password stored on the password worksheet
Signature:
Public Sub NewDebugingPassword(ByVal newValue As String)
Miscellaneous password operations.
Parameters:
newValue: String. The new debugging password.