如何使用VBA-Excell检查工作表上每个组合框的名称或特定名称? [英] How do I inspect the name of each combobox on a worksheet fo a particular name using VBA-Excell?

查看:73
本文介绍了如何使用VBA-Excell检查工作表上每个组合框的名称或特定名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作表上有几个组合框,它们的对象名称包含单词Product.我想选择每个组合框以更新列表项.

I have several comboboxes on a worksheet whose object names contain the word Product. I would like to select each of these comboboxes in order to update the list items.

我设法识别了组合框,但似乎无法确切地识别名称.

I have managed to identify comboboxes but I can't seem to identify the name specifically.

dim CBO as oleboject
set ws = sheets(1)
with sheets(1)
for each cbo in ws.oleobjects
if typename(cbo.object) = "ComboBox" then
 THE CHECK HERE FAILS
end if
next cbo
end with

我无法获得用于标识对象名称的代码.

I can't get the code to identify the name of the object.

推荐答案

您快到了.而不是使用

CBO.List = array(item1,item2)

您需要使用

CBO.Object.List = array(item1,item2)

这篇关于如何使用VBA-Excell检查工作表上每个组合框的名称或特定名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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