2012-09-21 48 views

回答

0

在这些文章中检查一些指针:

How to automate PowerPoint by using Visual Basic - Microsoft Support Microsoft Kb kb/555191

Automating a Powerpoint Presentation using VBA

代码的基础是这样的:

Dim oPPt, oPPs 
Set oPPt = CreateObject("PowerPoint.application") 
oPPt.Visible = True 
' Assuming your adding it to an existing powerpoint : ' 
Dim sPPtFile: sPPtFile = "C:\yourPowerpoint.pptx" 
Set oPPs = oPPt.Presentations.Open(sPPtFile) 

Dim oSlide 
Set oSlide = oPPs.Slides.Add(1, 2) 
oSlide.Shapes(1).TextFrame.TextRange.Text = "My first slide " 

oPPTFile.SaveAs "C:\yourPowerpointUpdated.pptx" 
oPPt.quit 
set oPPt = nothing