Class ProtectionState
Vba security properties
Inherited Members
Namespace: DRIT.Spreadsheet.Vba
Assembly: DRIT.Spreadsheet.dll
Syntax
public class ProtectionState
Properties
HostProtected
Specifies whether access to the VBA project was restricted by the VBA host application
Declaration
public bool HostProtected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsLockedForViewing
Specifies whether the VBA project is locked for viewing.
Declaration
public bool IsLockedForViewing { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPasswordProtected
Specifies whether the project currently has password protection metadata.
Declaration
public bool IsPasswordProtected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsProtected
Specifies whether the VBA project is protected (has password protection).
Declaration
public bool IsProtected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsUnlocked
Specifies whether the project is currently unlocked for this in-memory instance.
Declaration
public bool IsUnlocked { get; }
Property Value
| Type | Description |
|---|---|
| bool |
UserProtected
Specifies whether access to the VBA project was restricted by the user
Declaration
public bool UserProtected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
VbeProtected
Specifies whether access to the VBA project was restricted by the VBA project editor
Declaration
public bool VbeProtected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
VisibilityState
Specifies whether the VBA project is visible.
Declaration
public bool VisibilityState { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Lock()
Locks the project for this in-memory instance.
Declaration
public void Lock()
Protect(bool, string)
Protects the VBA project with a password.
Declaration
public void Protect(bool isLockedForViewing, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isLockedForViewing | Whether to lock the project for viewing. |
| string | password | The password to use for protection. |
SetPassword(string)
Password protect the VBA project. An empty string or null will remove the password protection
Declaration
public void SetPassword(string Password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | Password | The password |
TryUnlock(string)
Attempts to unlock the project for this in-memory instance.
Declaration
public bool TryUnlock(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password |
Returns
| Type | Description |
|---|---|
| bool |
VerifyPassword(string)
Verifies a password against the persisted protection metadata. This method has no side effects.
Declaration
public bool VerifyPassword(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| string | password |
Returns
| Type | Description |
|---|---|
| bool |