Help Center

ColWidthproperty

Returns or sets the width of the column in the specified band, intwips.

Windowspropertydoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

PROPERTY ColWidth (BYVAL Index AS LONG) AS LONG
PROPERTY ColWidth (BYVAL Index AS LONG, BYVAL nWidth AS LONG)

Parameters

NameDescription
IndexA Long value that specifies which column's width to change. To set the same width for all columns at once, use an index of -1.
nWidthA numeric expression that specifies the width of the specified column, in twips. Setting the width to 0 hides the column from the user.
BandNumberOptional. A Long value that specifies the band that contains the column.
IndexThe zero-based index of the row being checked.

Description

Returns or sets the width of the column in the specified band, in twips.

Examples

' Set a specific width for the first column (Index 0) grid.ColWidth(0) = 2000

' Hide the third column (Index 2) grid.ColWidth(2) = 0

' Set all columns to a standard uniform width grid.ColWidth(-1) = 1200

' Example: If Row 50 is not visible, scroll to it If Not grid.RowIsVisible(50) Then

grid.TopRow = 50

End If

Dim i As Long, count As Long For i = grid.TopRow To grid.Rows - 1 If grid.RowIsVisible(i) Then

count = count + 1

Else

Exit For

End If Next

Reference