【发布时间】:2016-06-26 09:50:37
【问题描述】:
我有这段代码,它复制一个名为 pastedpic 19 的形状,它是我的 Excel 文件中的形状 17,然后打开一个新的 PowerPoint 幻灯片并粘贴它。问题是我希望它被复制为正常范围并粘贴为这样我就可以在那里更改数据。
Sub exceltoPPT()
Dim PowerPointapp as Object
Dim myPresentation As Object
Dim mySlide As Object
Dim myShape As Object
Dim DestinationSheet7 As Worksheet
Dim DestinationSheet1 As Worksheet
Dim pastedPic3 As Shape
Set DestinationSheet1 = Workbooks("1_1_1_tt.xlsm").Sheets("Eingabefeld")
Set pastedPic9 = DestinationSheet1.Shapes(17)
' Create a New Presentation
Set myPresentation = PowerPointApp.Presentations.Add
'Add a slide to the Presentation
Set mySlide = myPresentation.Slides.Add(1, 11) '11 = ppLayoutTitleOnly
'pastedPic9.Copy
Windows(anan).Activate
Sheets("Eingabefeld").Range("B1:ES44").CopyPicture Appearance:=xlPrinter,Format:=xlPicture
'Paste to PowerPoint and position
mySlide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
'Set position:
myShape.Left = -15
myShape.Top = 11
End Sub
有人知道怎么做吗?
【问题讨论】:
标签: vba excel powerpoint