vba - 如何在 VBA 中将参数从文本传递到宏
问题描述
在为形状分配宏时,我知道您可以将形状作为参数传递,如下所示:
Sub DoSomething(CShp as Shape)
'code here using CShp as shape obj
End Sub
在 PowerPoint 中,您还可以突出显示文本并在单击时为其分配一个宏。是否可以将已单击的文本作为参数传递?我尝试了以下想法无济于事:
Sub GetText(ShpText as Textframe)
'Nothing passes
End Sub
Sub GetText(ShpText as TextRange)
'Nothing passes
End Sub
Sub GetText(Shp as Shape)
Dim TxtRng as TextRange
Set TxtRng = Shp.TextFrame.TextRange
'Passes the whole text but not the clicked text only
End Sub
非常感谢
解决方案
推荐阅读
- powershell - 如何从 PowerShell 命令中获取输出的第一个字
- node.js - 收到弃用警告,并建议使用我在 MongoDB/Mongoose 中使用的内容
- bash - 如果搜索文件时 elif 不起作用
- angular - 我们如何在 keydown 事件中识别角色的位置?
- css - CSS 网格重复网格布局
- java - 无法从 Observable 注销
- python - Python 错误 - 如何检查中间件是否在您的 PYTHONPATH 中以及如何将其添加到路径中?
- r - ISO 8061 dmy 在更改日期的某一行后无法解析
- asp.net-mvc - 如何在 ASP.NET API 中实现 PayEx 支付网关?
- python - 对无关窗口的奇怪 sdl 副作用