向PPT粘贴图片和表格数据
Sub CopyPictureToPPT()
Set ppt = New PowerPoint.Application
ppt.Presentations.Open "C:\Users\Administrator\Desktop\testforAutopadding\testForPicture.pptx", WithWindow:=msoFalse
ppt.Presentations(1).Slides(1).Shapes(1).Fill.UserPicture ("C:\Users\Administrator\Desktop\testforAutopadding\" & "red.jpg")
ppt.Presentations(1).Slides(1).Shapes(2).Fill.UserPicture ("C:\Users\Administrator\Desktop\testforAutopadding\" & "blue.jpg")
Dim oWs As Worksheet
Set oWs = ActiveWorkbook.Worksheets(1)
With ppt.Presentations(1).Slides(2).Shapes(2).Table
.Cell(1, 1).Shape.TextFrame.TextRange.Text = oWs.Cells(1, 1)
End With
With ppt.Presentations(1)
.Save
End With
Set oWs = nothing
ppt.Quit
Set ppt = nothing
End Sub