我已经研究了一段时间,并且还没有找到有关PowerPoint VBA是否可以确定对象(文本框或表格)是否在页面尺寸的边界之外的背景。
我试图管理的特定应用程序是当我通过查找/替换特定数据标记的excel中的ppt表中,我不知道文本的特定维度,因此我可能会溢出页面边界。
我也不能缩小文本,因为我必须维护类型大小的设计保真度。
我想尝试测量此溢出何时发生,并使用VB创建一个新页面,我可以继续从Excel流下文本。
现在,我只是通过限制页面模板来说15行,然后手动调整页面流量的方式来做到这一点。可能是我唯一的选择,但认为我会提出问题。
这应该使您入门:
Option Explicit
Sub TextboxCheck()
Dim shp As Shape
Dim sld As Slide
Dim sldHeight As Long
sldHeight = ActivePresentation.PageSetup.SlideHeight
For Each sld In ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoTextBox Then
If shp.Top + shp.Height > sldHeight Then
'Add your code here for moving the text to a new slide
End If
End If
Next shp
Next sld
End Sub