如何使用VBA重命名复选框 [英] How rename a checkbox with VBA
本文介绍了如何使用VBA重命名复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改我在新表中做的一些复选框的标题和方法的名称。我现在的代码是:
I want to change the caption and the method's name of some Checkbox that I'm doing in a new sheet. The code that I have so far is:
Sheets("Sheet1").OLEObjects.Add "Forms.CheckBox.1", _
Left:=Cells(fil_1, col_1).Left - 11.25, _
Top:=Cells(fil_1, col_1).Top, _
Width:=Range("A1").Width, Height:=Range("A1").Height
'Caption:=""
推荐答案
像这样:
Set ole = ActiveSheet.OLEObjects
ole(1).Name = "New Name"
ole(1).Object.Caption = "New Caption"
或者为了更容易,只需修改你的例子:
Or to make it easier, simply modifying your example:
set newCheckbox = Sheets("Sheet1").OLEObjects.Add "Forms.CheckBox.1", _
Left:=Cells(fil_1, col_1).Left - 11.25, _
Top:=Cells(fil_1, col_1).Top, _
Width:=Range("A1").Width, Height:=Range("A1").Height
'Change name and caption
newCheckbox .Name = "New Name"
newCheckbox .Object.Caption = "New Caption"
这篇关于如何使用VBA重命名复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文