Monday, June 14, 2010

QTP Powerpoint Automation (VBScript)

'OPENING a new PPT, ADDING a picture into it, SAVING the PPT file and CLOSING it.

Set obj_ppt = CreateObject("PowerPoint.Application")
‘Using the Add method to create a new presentation and add it to the collection
Set obj_Pre = obj_ppt.Presentations.Add()
‘Adding slides to the presentation
Set obj_Slide = obj_Pre.Slides.Add(1,12)
Set pic = obj_Slide.shapes.AddPicture("C:\untitled.bmp",-1,-1,72,80)
obj_Pre.SaveAs("C:\untitled.ppt")
obj_Pre.Close
obj_ppt.Quit


Also See:

1. OPENING a new PPT, ADDING a title & text into it, SAVING the PPT file and CLOSING it.
2. OPENING an already existing PPT file, ADDING a slide, WRITING tilte & text to the slide, SAVING and CLOSING the PPT
3. OPENING a new PPT, ADDIND a blank slide to it, ADDING table, ENTERING text, SAVING & CLOSING PPT
4.Creating a chart in Powerpoint & manipulating it