我在Excel中有这个代码,但是我需要在Powerpoint中使用相同的东西,但我无法让它工作。
Sub Macro1()
' Macro1 Macro
ActiveSheet.Pictures.Insert("C:\Users\BobDylan\Pictures\Prince Symbol.jpg" _
).Select
Selection.ShapeRange.IncrementLeft 45
Selection.ShapeRange.IncrementTop 27
Selection.ShapeRange.ScaleWidth 1.2272727273, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.2272727273, msoFalse, msoScaleFromTopLeft
Range("K16").Select
End Sub
答案 0 :(得分:0)
这是一些让你入门的东西:
ActivePresentation.Slides(1).Shapes.AddPicture "C:\Users\BobDylan\Pictures\Prince Symbol.jpg", msoFalse, msoTrue, 10, 10, 100, 100
<强>更新强>
在您的问题后添加
Sub test()
Dim TargetSlide As Slide
Dim pptLayout As CustomLayout
Set pptLayout = ActivePresentation.Slides(1).CustomLayout
Set TargetSlide = ActivePresentation.Slides.AddSlide(ActivePresentation.Slides.Count, pptLayout)
TargetSlide.Shapes.AddPicture "C:\Users\BobDylan\Pictures\Prince Symbol.jpg", msoFalse, msoTrue, 10, 10, 100, 100
End Sub