1

我收到以下代码的错误消息:

Dim objPPT As PowerPoint.Application
Dim objPres As PowerPoint.Presentation

'Opening blank presentation
Set objPPT = WScript.CreateObject("PowerPoint.Application")
objPPT.visible = 1
Set objPres = objPPT.presentations.Add
objPres.Slides.Add (1, PowerPoint.PpSlideLayout.ppLayoutBlank)

此脚本停止执行,提示错误消息为Line 1 Char 12 Expected End of statement

我是 vbscript 的新手,如果我犯了一些错误,请帮忙。

4

1 回答 1

4

要使用vbscript,您必须了解 vbscript 的语法。下面是添加幻灯片到 PPT 的示例代码(此处使用的 PPT 模板)

' Add a Slide to a Microsoft PowerPoint Presentation
 Const ppLayoutText = 2

 Set objPPT = CreateObject("PowerPoint.Application")
 objPPT.Visible = True

 Set objPresentation = objPPT.Presentations.Add

 objPresentation.ApplyTemplate _
 ("C:\Program Files\Microsoft Office\Templates\1033\ProjectStatusReport.potx")

 Set objSlide = objPresentation.Slides.Add _
 (1, ppLayoutText)
于 2012-07-16T08:29:12.457 回答