开发者

How to move image down using vba in powerpoint from excel?

I am new to vba and macros in powerpoint.. What is the correct syntax to position an image down -30?

PPT.ActiveWindow.View.GotoSlide 9

Set PPApp = GetObject(, "Powerpoint.Application")
' Reference active presentation
Set PPPres = PPApp.ActivePresentation
' Reference active slide
Set PPSlide = PPPres.Slides _
    (PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)
' Copy chart as a picture
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, _
    Format:=xlPicture
' Paste chart
PPSlide.Shapes.Paste.Select
' Align pasted chart

Dim xyz As Shape
Se开发者_高级运维t xyz = PPSlide.Shapes.Selection


PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
xyz.Top = xyz.Top - 30


UPDATED

Based on your code sample, I think you want to try something like this:

 PPSlide.Shapes.Paste.Select
' Align pasted chart

PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
PPApp.ActiveWindow.Selection.ShapeRange(1).Top = PPApp.ActiveWindow.Selection.ShapeRange(1).Top + 30

You can take out the lines referring to xyz.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜