Event Macros是否具有像Me或This一样的自引用能力?

huangapple go评论111阅读模式
英文:

Do Event Macros have a self-reference capacity like Me or This?

问题

我想要一系列按钮,点击后使用宏来创建一个包含按钮标题的TempVar。
我真的不想使用VBA,因为表单中的其他所有内容都是宏。
目前,我有一个使用以下选择器创建TempVar的宏:
[Command5].[Caption]
但是,我想用[Me]或[This]来替代[Command5]。这样我就可以复制粘贴按钮,而不必打开每个新按钮并更新控件名称。

英文:

I'd like to have a series of buttons that after being clicked, use a macro to create a TempVar containing the caption of the button.
I really don't want to have to use VBA, as everything else in the form is a macro.

At the moment, I have a macro that creates a Tempvar using this selector:

[Command5].[Caption]

However, I'd like to replace [Command5] with something Me or This. Then I could copy & paste the button without having to open each new one and update the control name.

答案1

得分: 1

你可以使用[Screen].[ActiveControl]方法。设置临时变量如下-

[Screen].[ActiveControl].[Caption]

然后将tempvar用于进一步操作。请参考下面的截图以获得更清晰的图示。

Event Macros是否具有像Me或This一样的自引用能力?

英文:

You can utilize [Screen].[ActiveControl] method. Set temporary variable like-

[Screen].[ActiveControl].[Caption]

Then use that tempvar for further action. See the below screenshot for better picture.

Event Macros是否具有像Me或This一样的自引用能力?

huangapple
  • 本文由 发表于 2023年4月4日 09:48:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75924915.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定