将标题行添加到列表框

问题描述 投票:0回答:1

我正在使用列表框在word中的userforms中显示数据。但是,我无法设置标题标题或弄清楚如何使单击标题以按该列排序。

GUI.Search_ListBox.Clear
GUI.Search_ListBox.ColumnCount = 5 ' Columns
GUI.Search_ListBox.ColumnWidths = "120;80;70;120;300"
GUI.Search_ListBox.ColumnHeads = True
'GUI.Search_ListBox.RowSource = "Hello;gkjfl;hsjgh;hdfjhgkj;fdjghjkdf" 'here it fails!!!

enter image description here

vba word-vba
1个回答
0
投票

使用VBA,只需将ListBox.ColumnHeads属性设置为True


或者,您也可以在ActiveX控件的Properties对话框中更改设置:

Properties

如果功能区上的按钮被禁用,则必须先输入。


更多信息:


编辑:

您需要在rowsource中指定标题:

列标题已启用,字段标题,字段名称或第一行数据项用作列标题。

© www.soinside.com 2019 - 2024. All rights reserved.