Object: CellBlock
- Updated2024-09-12
- 1 minute(s) read
(CellChannelFormatter | Sheet) > Object: CellBlock
Object: CellBlock
The CellBlock object makes accessing data in a workbook easier.
A CellBlock can contain one or more DirectAccess channels. The channel values are organized columnwise in this block.
You read the contents of a workbook as follows:
- use the Workbook.GetCellBlock method and assign the return value to a variable.
- add a DirectAccess channel to the CellBlock for each channel to be read,
- assign the complete DirectAccess channel to a channel group.
| Note The file pointer of the worksheet does not move when a CellBlock is read out. |
The following example reads in the values of the worksheet columnwise from the second row of the first column and saves the values in channels of the first channel group:
Dim oCurrSheet Set oCurrSheet = Workbook.Sheets(1) Dim oCellBlock Set oCellBlock = oCurrSheet.GetCellBlock(2,1) Dim i, Name, oNewChannel For i = 1 to oCurrSheet.MaxPosition.Column Name = oCurrSheet.GetCellValue(1,i) Set oNewChannel = oCellBlock.Channels.Add(Name) Call Root.ChannelGroups(1).Channels.AddDirectAccessChannel(oNewChannel) Next