2012-09-21 77 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