将参数传递给使用onAction事件注册的方法(VBA - Excel) [英] Passing Arguments to Method registered with onAction Event(VBA - Excel)
本文介绍了将参数传递给使用onAction事件注册的方法(VBA - Excel)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码是:
使用ActiveSheet.CheckBoxes.Add(rCell.Left,rCell.Top,rCell.Width,rCell.Height)
.Interior.ColorIndex = xlNone
.Caption =
.OnAction =CheckboxChange
结束
我想将rCell传递给CheckboxChange子例程。任何方式做到这一点基本上我想知道CheckboxChange子例程中复选框的单元格。
解决方案
更改:
.OnAction =CheckboxChange
为此:
.OnAction ='CheckboxChange& rCell&
= 3双引号
'= 3双引号& 1单引号& 1双引号
How do you pass an argument to a method which is registered with the onAction event in Excel VBA?
The code I have is:
With ActiveSheet.CheckBoxes.Add(rCell.Left, rCell.Top, rCell.Width, rCell.Height)
.Interior.ColorIndex = xlNone
.Caption = ""
.OnAction = "CheckboxChange"
End With
I want to pass the "rCell" to the "CheckboxChange" sub routine. Any way to do that. Basically I want to know the cell in which the checkbox was present in the CheckboxChange sub routine.
解决方案
Change this:
.OnAction = "CheckboxChange"
To this:
.OnAction = "'CheckboxChange""" & rCell & """'"
""" = 3 double quotes
"""'" = 3 double quotes & 1 single quote & 1 double quote
这篇关于将参数传递给使用onAction事件注册的方法(VBA - Excel)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文