我想将可点击复选框(一个或多个)添加到PowerPoint演示文稿幻灯片中。我正在使用MacOS和MicrosoftOffice365。
我想使用用VBA创建的宏是可能的,但我不知道需要为此创建什么代码。
如果你能分享必要的代码,或者建议我另一个相关的方法,在Mac下的pptx中创建可点击的复选框,我将非常感激。
发布于 2021-04-22 15:38:12
复选框、标签、文本框等都是ActiveX特性,而且由于ActiveX在或MacOS中通常不受支持,所以您不能像在Windows版本的Office中那样这样做。
您可以通过添加绘制的矩形并为每个矩形分配一个Run宏操作设置来伪造它。
我维护的PPT FAQ上的这一页解释了如何编写宏。确定单击了哪个形状https://www.pptfaq.com/FAQ00141_Determine_which_shape_was_clicked.htm
TL;DR -这是一些示例代码。这在Windows和Mac上都能运行(PPT的VBA模型中的bug迫使它变得比以前更加复杂):
Sub DoSomethingTo(oSh as Shape)
Dim oSl as Slide
Dim oShTemp as Shape
' oSh.Parent returns a valid reference to the shape's host slide:
Set oSl = ActivePresentation.Slides(oSh.Parent.SlideIndex)
' and oSh.Name works:
MsgBox oSh.Name
' So we use those two bits to get a reference
' to the clicked shape like so
Set oShTemp = oSl.Shapes(oSh.Name)
With oShTemp
.TextFrame.TextRange.Text = oSh.Name
' and whatever else you want to do with the shape
End With
End Sub
https://stackoverflow.com/questions/67204470
复制相似问题