ComboBox.ColumnWidth 屬性 (Access)ComboBox.ColumnWidth property (Access)

ColumnWidth 屬性可用於資料工作表檢視中指定的欄寬。You can use the ColumnWidth property to specify the width of a column in Datasheet view. 可讀寫的 IntegerRead/write Integer.

語法Syntax

運算式ColumnWidthexpression.ColumnWidth

_運算式_代表**ComboBox** 物件的變數。expression A variable that represents a ComboBox object.

註解Remarks

在 Visual Basic 中的ColumnWidth屬性設定為整數值,代表以twip 為單位的欄寬。In Visual Basic, the ColumnWidth property setting is an Integer value that represents the column width in twips. 您可以自己指定寬度,或使用下列其中一個預先定義的設定值。You can specify a width or use one of the following predefined settings.

設定Setting 描述Description
00 隱藏資料行Hides the column.
11 (預設值) 將資料行大小調整成預設寬度(Default) Sizes the column to the default width.

[!注意事項] 當表單處於資料工作表檢視 ColumnWidth 屬性可套用於 [資料工作表檢視中的全部欄位和表單控制項。The ColumnWidth property applies to all fields in Datasheet view and to form controls when the form is in Datasheet view.

設定此屬性設為 0,或調整為零寬度資料工作表檢視中的欄位將欄位的ColumnHidden屬性設定為True (1),並隱藏資料工作表檢視中的欄位。Setting this property to 0, or resizing the field to a zero width in Datasheet view, sets the field's ColumnHidden property to True (1) and hides the field in Datasheet view.

欄位的 ColumnHidden 屬性設定為 False (0) 還原此欄位的 ColumnWidth 屬性欄位已隱藏之前的值。Setting a field's ColumnHidden property to False (0) restores the field's ColumnWidth property to the value it had before the field was hidden. 例如,如果ColumnWidth屬性為 1 之前要隱藏屬性設定為 0 的欄位,變更欄位的ColumnHidden屬性設為 False ColumnWidth將重設為 1。For example, if the ColumnWidth property was 1 prior to the field being hidden by setting the property to 0, changing the field's ColumnHidden property to False resets the ColumnWidth to 1.

當欄位的 ColumnHidden 屬性設為 True ,無法使用欄位的 ColumnWidth 屬性。The ColumnWidth property for a field isn't available when the field's ColumnHidden property is set to True.

範例Example

本範例會在資料工作表檢視中開啟的 [客戶] 表單,才會生效。This example takes effect in Datasheet view of the open Customers form. 它將列高設定為 450 Twip,並調整資料行大小,以符合可見文字的大小。It sets the row height to 450 twips and sizes the column to fit the size of the visible text.

Forms![Customers].RowHeight = 450 
Forms![Customers]![Address].ColumnWidth = -2

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.