PowerPoint宏粘贴在固定位置 [英] PowerPoint Macro to paste at a fixed location

查看:157
本文介绍了PowerPoint宏粘贴在固定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个PowerPoint VB宏来在我的所有幻灯片上粘贴相同的图像(在主幻灯片上插入它不起作用,因为它保留在背景中并在前景中覆盖大图片)。 br $>


我找到(并改编)以下片段:



  Sub  SuperDuper()
Dim x As

对于 x = 1 ActivePresentation.Slides.Count
ActivePresentation.Slides(x).Shapes.Paste
下一步

结束 Sub





它执行粘贴操作,但粘贴位置从幻灯片更改为幻灯片。我该如何解决这个问题?

解决方案

我使用过这段代码:

 ActiveWindow.View.Paste 
ActiveWindow.Selection.ShapeRange( 1 )。Name = shapeName
使用 NewPres .Slides(SlideNumber).Shapes(shapeName)
.Height = gridHeight
.Width = gridWidth
.Left = gridLeft
.Top = gridTop
.ZOrder gridZOrder
结束 使用





粘贴之后,它仍然被选中,这样你就可以给它一个名字,然后用它来引用它并设置它的各种属性。


这是我的最后一个,清理过 - 脚本。一旦你知道食谱就很简单:

  Sub  PasteToAll()
对于 i = 1 ActivePresentation.Slides.Count
设置 MyRange = ActivePresentation.Slides(i).Shapes.Paste
MyRange( 1 ).Left = 100
MyRange( 1 )。Top = 100
下一步
结束


Hi, I need to write a PowerPoint VB macro to paste the same image on all my slides (inserting it on the Master slide does not work as it remains in the background and gets overlaid with large pictures in the foreground).

I have found (and adapted) the following snippet:

Sub SuperDuper()
    Dim x As Long

    For x = 1 To ActivePresentation.Slides.Count
        ActivePresentation.Slides(x).Shapes.Paste
    Next

End Sub



it does execute the Paste operation, but the pasting location changes from slide to slide. How can I fix this ?

解决方案

I have used this code:

ActiveWindow.View.Paste
ActiveWindow.Selection.ShapeRange(1).Name = shapeName
With NewPres.Slides(SlideNumber).Shapes(shapeName)
    .Height = gridHeight
    .Width = gridWidth
    .Left = gridLeft
    .Top = gridTop
    .ZOrder gridZOrder
End With



After it pastes it is still selected so you can then give it a name and reference it that way and set it's various properties.


Here is my final, cleaned-up script. Very simple once you know the recipe:

Sub PasteToAll()
    For i = 1 To ActivePresentation.Slides.Count
        Set MyRange = ActivePresentation.Slides(i).Shapes.Paste
        MyRange(1).Left = 100
        MyRange(1).Top = 100
    Next
End Sub


这篇关于PowerPoint宏粘贴在固定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆