QTP CHARTS
Option explicit
Dim exo, wbo, wso, rngo, cho
'open new excel file sheet using VBScript
Set exo=createobject("excel.application")
Set wbo=exo.workbooks.open ("C:\Documents and Settings\qa\Desktop\QTP Practice\PATH FILES\Excel Charts Comparison1.xls")
Set wso=wbo.worksheets("sheet1")
Exo.visible=true
Set rngo= wso.range("B2", "C21")
'Create a new chart for selected data (“B2”, “C21”) using VBScript
Set cho= wbo.charts.add
Cho.name= "Run Rate"
Cho.charttype=65 'any number between 61-70
Cho.SetSourceData rngo, 2 '2 is the second component in sheet1, the 1st component is scores table
Cho.location 2, "sheet1"
'save excel file and close application
Wbo.save
Exo.quit
Set wso=nothing
Set wbo=nothing
Set exo=nothing
Set rngo=nothing
Set cho=nothing
No comments:
Post a Comment