Monday, June 14, 2010

QTP Powerpoint Automation (VBScript)-4

'OPENING a new PPT, ADDING a blank slide to it, ADDING table (2 rows, 2 columns), ENTERING TEXT in cell(1,1) and SAVING PPT file and CLOSING it.

Set obj_ppt = CreateObject("PowerPoint.Application")
Set obj_Pre = obj_ppt.Presentations.Add()
Set obj_Slide = obj_Pre.Slides.Add(1,12)
AddTable(NumRows, NumColumns, Left, Top, Width, Height)
obj_Slide.Shapes.addtable 2, 2, 100, 150, 500, 100
obj_Slide.Shapes(1).Table.Cell(1, 1).Shape.TextFrame.TextRange.Text = "Row1- Col1"
obj_Pre.SaveAs("C:\untitled.ppt")
obj_Pre.Close
obj_ppt.Quit




















Also See:

1. Opening a new PPT, adding a picture into it, saving it and closing the PPT
2. OPENING a new PPT, ADDING a title & text into it, SAVING the PPT file and CLOSING it.
3. OPENING an already existing PPT file, ADDING a slide, WRITING tilte & text to the slide, SAVING and CLOSING the PPT
4. Creating a chart in Powerpoint & manipulating it