将列标题添加到组合框(ActiveX控件),VBA 7.0,Excel 2010 [英] Adding a column header to a Combo box (ActiveX control), VBA 7.0, Excel 2010

查看:167
本文介绍了将列标题添加到组合框(ActiveX控件),VBA 7.0,Excel 2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我使用VBA 7.0在Excel 2010上创建了一个工作簿。

I created a workbook on Excel 2010, using VBA 7.0.

我在工作表中添加了一个组合框(ActiveX)和  填充它没有问题。

I added to a worksheet a Combo box (ActiveX) and filled it without problem.

我的问题是我无法将列标题设置为my组合框。

My issue is that I cannot set a columns header to my combo box.

我在组合中定义:ColumnsHeads为true。

I defined into the combo : ColumnsHeads to true.

但我不知道如何填充标题(我有一个包含标题内容的1D数组。

But I don't know how to fill the header (I have a 1D array with the header content).

尝试使用rowsource属性填充标题,但获得  运行时错误#438:

对象不支持此属性或方法。

Tried to fill the header with rowsource property but get a Run-Time Error #438:
Object doesn't support this property or method.

关于如何进行的任何想法?

谢谢。

Fred。

推荐答案

将ColumnHeads设置为True仅当组合框的ListFillRange设置为工作表上的范围时才有效,而不是使用AddItem填充组合框。

Setting ColumnHeads to True only works if the ListFillRange of the combo box is set to a range on a worksheet, not if you populate the combo box using AddItem.

如果设置ListFillRange,则紧接在上面的行范围将用作列标题。您不能单独指定列标题。

If you set the ListFillRange, the row immediately above that range will be used as column header(s). You cannot specify the column headers separately.


这篇关于将列标题添加到组合框(ActiveX控件),VBA 7.0,Excel 2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆