LockXLS On-line Help Library

Welcome
Getting Started
Using LockXLS
How to ...
Samples
About LockXLS
Purchase
Contact

Excel Object Model Protection Options.

Options on this page define how your workbook could be accessed from another workbooks and external application.

Allow to save workbook in non-protected format using "Save As" method. In protected workbook Workbook.SaveAs method creates protected file. All data, saved by your VBA macros will be stored on disk as protected files.

If you need to save your workbook as usual non-protected workbook and give your customer full access to data inside of your workbook - you should use this option.

When this option is selected, and Unlock Code entered - Save As method saves your workbook as unlocked file. Unlock Code is needed to identify code which has permission to save workbook without protection.

This code shows you how to save workbook as usual Excel file

' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")

' provide Unlock Code
oLockXLS.UnlockSaveAs ("<Your Unlock Code for SaveAs method>")
ThisWorkbook.SaveAs "<Path to new file>"
' Lock SaveAs method again
oLockXLS.LockSaveAs

' release LockXLS Runtime object
Set oLockXLS = Nothing

Allow to access to data on hidden sheets. Allows external application to access data on hidden sheets, after providing Unlock Code. If Unlock Code is empty, data on the hidden sheets is accessible.

This code shows how to pass Unlock Code to LockXLS Runtime to access data on hidden sheets

' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")

' provide Unlock Code
oLockXLS.UnlockDataOnHiddenSheets ("<Your Unlock Code>")
' your code which works with hidden data
...
' Lock hidden data again
oLockXLS.LockDataOnHiddenSheets

' release LockXLS Runtime object
Set oLockXLS = Nothing

Allow external macros/applications to access Object Model of locked workbook. Allows external VBA macros/application to access objects in the locked workbook:

  • set/change formulas
  • protect/unprotect sheets
  • ...

This code shows how to pass Unlock Code to LockXLS Runtime to access Object Model

' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")

' provide Unlock Code
oLockXLS.UnlockObjectModel("<Your Unlock Code>")
' your code
...
' Lock Object Model again
oLockXLS.LockObjectModel

' release LockXLS Runtime object
Set oLockXLS = Nothing