是否可以识别在 Powerpoint 演示文稿上触发鼠标悬停的形状 ID?
是否可以识别在 Powerpoint 演示文稿上触发鼠标悬停的形状 ID。
我想要做的是在带有标题的幻灯片上显示一系列形状,当用户将鼠标悬停在形状上时,我想使用 VBA 在页面的另一部分(可能在单独的帮助文本中)显示有关该形状的更多详细信息盒子。然后,我可以使用选定的形状 ALT 文本来显示在帮助框中。我看不到的是如何识别触发鼠标悬停宏的形状。这可能吗?如果我可以识别触发该动作的形状,我就可以获取有关该形状的信息。
Is it possible to identify the shape ID that triggers a mouseover on a powerpoint presentation.
What I want to do is have a series of shapes on a slide with titles, and when the user mouseovers a shape, I want to use VBA to show more details about the shape in another part of the page, possibly in a separate help text box. I could then use the selected shapes ALt Text to display in the help box. What i can't see is how to identify what shape has triggered the mouseover macro. Is this possible? If I can identify the shape that triggered the action, I could then get info about that shape.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PowerPoint 中的 Shape 对象不允许您像通常与 VBA 代码中的其他对象一样与其事件进行交互。仅有的两个公开的“事件”实际上并不是 VBA 事件。它们是一个名为 Actions 的特殊类,它们是“ppMouseOver”和“ppMouseClick”。如果您事先知道有关形状及其相应信息的所有信息,您可以编写一些代码来执行您想要的操作,但它全部都是硬编码的,这可能不是您想要的。
当演示开始时,您可以运行类似这样的例程:
然后每当您对这些形状进行鼠标悬停时,都会运行以下例程之一。
这是非常有限的,需要您为幻灯片上的每个形状编写一个子例程。可能不是您想要的方法,但同样,使用 PowerPoint,您的选择非常有限。
The Shape object in PowerPoint does not allow you to interact with its events as you normally would with other objects in VBA code. The only two 'events' that are exposed are not actually VBA events. They are a special class called Actions, and they are 'ppMouseOver' and 'ppMouseClick'. If you know all the information about your shapes and their corresponding information beforehand, you could write some code to do what you want, but it would all be hard-coded, which is probably not what you want.
You could run a routine something like this when the presentation starts:
And then whenever you did a MouseOver of those shapes, one of the following routines would run.
This is very limited and requires that you write a subroutine for every shape on your slide. Probably not the approach you want, but again, with PowerPoint, your options are very limited.
StackOverflow 新手,迟来回答,但您可以执行以下操作:
分配您想要与运行宏的操作设置交互的每个形状,并选择
RespondToShape
作为宏。New to StackOverflow, late to answer, but you can do this:
Assign every shape you want to interact with an Action setting of Run Macro and choose
RespondToShape
as the macro.