Thursday, February 23, 2012

Inserting picture in excel sheet using VBScript/ QTP

Following code can be used to insert pictures in to the excel file. All you need to give is the path of the excel file in which the picture to be inserted & the path of the picture file to be inserted.

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objworkbook  = objExcel.WorkBooks.Open("C:\exceltest.xls")
Set objworksheet = objworkbook.Worksheets(1)
Set objExcel = Nothing
Set objworkbook  = Nothing
Set objworksheet = Nothing
Set objusedrange = Nothing

1 comment: