确定PowerPoint文本框是否超出页面大小 [英] Determining if a powerpoint text box is over the page size
问题描述
我已经对此进行了一段时间的研究,但没有发现Powerpoint VBA是否可以确定对象(文本框或表)是否超出页面尺寸范围的背景.
I've been researching this for a while and have not found any background on whether Powerpoint VBA can determine if an object (text box or table) is outside the bounds of the page dimensions.
我要管理的特定应用程序是当我通过查找/替换特定数据标记从Excel将文本流到PPT表中时,我不知道文本的特定尺寸,因此我可能会溢出页面边界.
The specific application I am trying to manage is when I flow text into a PPT table from Excel, through a find/replace of specific data markers, I don't know the specific dimensions of the text, so I may overflow the page boundary.
我也不能缩小文本,因为我必须保持字体大小的设计保真度.
I cant shrink the text either, as I have to maintain the design fidelity of the type size.
我想尝试测量何时发生溢出,并使用VB创建一个新页面,我可以继续在该页面上从Excel中流文本.
I would like to try and measure when this overflow happens and use VB to create a new page onto which I can continue to flow my text from Excel.
现在,我通过将页面模板限制为15行,然后手动调整页面上/下流量来做到这一点.可能是我唯一的选择,但我想提出这个问题.
Right now I am doing this by just limiting the page template to say 15 rows and then manually adjusting over/under flow of the page. Might be my only option, but thought I would pose the question.
推荐答案
这应该使您入门:
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
这篇关于确定PowerPoint文本框是否超出页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!