我想更改我在新工作表中执行的某些复选框的标题和方法名称。我到目前为止的代码是:
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:=""
答案 0 :(得分:0)
像这样:
Set ole = ActiveSheet.OLEObjects
ole(1).Name = "New Name"
ole(1).Object.Caption = "New Caption"
或者为了简化,只是修改您的示例:
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"