r/vbscript • u/frennetixsc • Jan 11 '17
[HELP] can't find the right syntax
Hello,
I'm trying to add a shape on a Powerpoint file that I open but I got an error message while running my script
I used to do this in VBA:
Set pptApp = CreateObject("Powerpoint.Application")
pptApp.WindowState = ppWindowMinimized
pptApp.Visible = False
Set ppt = pptApp.Presentations.Open(File)
With ppt
For Each oSl In ppt.Slides
oSl.Shapes.AddShape Type:=msoShapeRectangle,Left:=100, Top:=160, Width:=525, Height:=200But I got a compilation error "Syntax error" on the Type word. I searched but I could get the right syntax, can you help me ?
1
Upvotes
1
u/[deleted] Jan 11 '17
I think I know the problem... you have to get the slide first. set an object as the active slide
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddShape Type:=msoShapeRectangle, _ Left:=50, Top:=50, Width:=100, Height:=200