|
Public Sub 技巧()
Dim ws As Worksheet
Dim pptApp As PowerPoint.Application
Dim pptPrs As PowerPoint.Presentation
Dim i As Long
Dim myppt As String
myppt = ThisWorkbook.Path & "PowerPoint试验.ppt"
Set ws = Worksheets(1) '指定工作表
ws.ChartObjects(1).Copy '复制指定的图表
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
Set pptPrs = pptApp.Presentations.Open(myppt) '打开PowerPoint文档
With pptPrs '在文档最后插入一个新幻灯片,并粘贴图表
.Slides.Add(Index:=.Slides.Count + 1, Layout:=ppLayoutText).Shapes.Paste
.Save
' .Close '设置此语句可关闭创建的文档
End With
' pptApp.Quit '设置此语句可关闭PowerPoint应用程序
Set ws = Nothing
Set pptPrs = Nothing
Set pptApp = Nothing
End Sub
下载我的附件,解压后在该文件所在的文件夹里再建立一个名为:PowerPoint试验.ppt
这是一个图片的方法,其他的你自己改吧 |
|