使用VBA在EXCEL中创建ActiveX CheckBox [英] Creating an ActiveX CheckBox in EXCEL using VBA
问题描述
我正在尝试在空白工作表上创建一个复选框。复选框已创建,我可以设置左侧属性。但是,Caption属性不存在。当我在Excel中查看Checkbox的属性时,标题属性存在。我在做什么
错了?
I am trying to create a checkbox on a blank worksheet. The Checkbox is created and I can set the left property. However, the Caption property does not exist. When I look at the properties of the Checkbox in Excel the caption property exists. What am I doing wrong?
Private Sub TestCheckBox()
Dim oCB As OLEObject
设置oCB = ActiveSheet .OLEObjects.Add(ClassType:=" Forms.CheckBox.1")
oCB.Left = 0
oCB.Caption =" Success" '这个失败了b
结束子
Private Sub TestCheckBox()
Dim oCB As OLEObject
Set oCB = ActiveSheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1")
oCB.Left = 0
oCB.Caption = "Success" ' This Fails
End Sub
推荐答案
您好,
请使用
oCB.Object.Caption = "Success"
此外,此论坛(开发Office 2013的应用程序)用于使用Office JavaScript API时的开发问题,因此我将此线程移至 Excel
for Developers 论坛。
Besides, this forum (Developing Apps for Office 2013 ) is for development issues when using Office JavaScript API, so I would move this thread into Excel for Developers forum.
问候,
Celeste
这篇关于使用VBA在EXCEL中创建ActiveX CheckBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!