VBA:我可以在不输入名称的情况下参考点击的按钮吗?

时间:2015-05-22 18:50:07

标签: forms vba class button

我有三个几乎相同的按钮类(只有CellTypes(r)参数不同)

Private Sub TheButton_Click()
  Dim kolorTemp, tempI As Double
  Dim r As String

  colorTemp = GetColor
  r = TheButton.Name

  TheButton.BackColor = colorTemp
  CellTypes(r).color = colorTemp
End Sub

我想再添加一个类,然后我开始徘徊是否有任何方法可以引用TheButton而无需在代码中多次编写它。就像Me适用于UserForm一样。

我知道我可以使用With TheButton,但如果还有其他方法,我只是在徘徊。

0 个答案:

没有答案