LockXLS On-line Help Library

Welcome
Getting Started
Using LockXLS
How to ...
General Questions
Questions about LockXLS activation
Advanced Questions
LockXLS Runtime Menu
Samples
About LockXLS
Purchase
Contact
Export cells with a specific background to external file

Export cells with a specific background to external file.

You can export all input cells (which does not contain formulas) with a specific background into text file. This feature is useful, when you need to transfer user's data between different versions of your spreadsheet.

This export procedure is called from VBA macro. Method LockXLSRuntime.ExportCellsByColor( <workbook>, <ColorIndex>, <FilePath>) exports all input cells from passed workbook with specified ColorIndex of the background into file. You may pass empty string as file path. In this case LockXLS Runtime asks customer to select a file.

Example of exporting all cells without background color:

Public Sub ExportInputCells()
' declare variable for LockXLS Runtime object
Dim oLockXLS As Object
' create LockXLS Runtime object
Set oLockXLS = CreateObject("LockXLSRuntime.Connect")
' export cells
oLockXLS.ExportCellsByColor ( ThisWorkbook, ThisWorkbook.Sheets(1).Range("A1").Interior.ColorIndex, "" )
' release LockXLS Runtime object
Set oLockXLS = Nothing
End Sub

In this example we use Color Index of the background of cell A1. As we know that in our spreadsheet this cell does not have a background color.