Reputation: 4249
I am getting error message with the following code:
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)
This Script stops execution prompting error message as Line 1 Char 12 Expected End of statement
I am new to vbscript, Please help if I am making some mistake.
Upvotes: 1
Views: 10833
Reputation: 3970
To use vbscript, you must know syntax of vbscript. Below is example code to Add a Slide to PPT (PPT Template used here)
' 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)
Upvotes: 4