简体   繁体   English

Powerpoint VBA-将文本框和文本复制到所有幻灯片(不选择)

[英]Powerpoint VBA - Copying Text box AND Text to all slides (w/o selecting)

I am in the process of automating some data output powerpoints and I need a script that will copy all text boxes with text to all the slides, also I need to specify the orientation (left/top/width/height) . 我正在自动化一些数据输出powerpoint的过程中,并且需要一个脚本,该脚本会将带有文本的所有文本框复制到所有幻灯片,还需要指定方向(左/上/宽/高)。 I am setting up just the first slide with a tittle and want it to copy to 100+ slides in the exact same orientation. 我只用标题设置了第一张幻灯片,并希望它以完全相同的方向复制到100多张幻灯片中。

I was able to find the following code: 我能够找到以下代码:

Dim oSh As Shape Dim x As Long 形状暗淡x尽可能长

 Set oSh = ActiveWindow.Selection.ShapeRange(1)

 For x = 2 To ActivePresentation.Slides.Count
     oSh.Copy
     ActivePresentation.Slides(x).Shapes.Paste
 Next

but it requires me to have the text box selected, and that is not what I want. 但这需要我选择文本框,而这不是我想要的。 I've searched but cannot seem to find what I want . 我已经搜寻了,但似乎找不到我想要的。

Thank you ! 谢谢 !

'Set oSh = ActiveWindow.Selection.ShapeRange(1)
Set oSh = ActivePresentation.Slides(1).Shapes(n)
' You'll need to work out the value of n for your particular slide layout

 For x = 2 To ActivePresentation.Slides.Count
     oSh.Copy
     ActivePresentation.Slides(x).Shapes.Paste
 Next

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM