kapilrakh wrote:@RJK
The trend is already there on the excel sheet. It would be great to manipulate an existing trend instead of inserting a new one everytime.
When you add a trend and a trace , we basically have 4 objects on the sheet. Those are,
ExcelTrendWizard1_Sheet1
PITrend1_Sheet1
PIExcelData1_Sheet1
PIArchiveData1_Sheet1
Using these existing objects solving this problem would be an ideal solution.
All you need to do is change a couple of lines in the example code I posted.
Rather than adding the object, set the variable to the OleObject that represts the Trend and the ExcelData container. Then on the trend, clear any existing datasourceenvironments, configure your ExcelData using AddQuerySpecs method then add the ExcelData as a DataSoruceEnvironment for the Trend.
Should find a few minutes spare in the morning to post the code for what I mean.
Principal Consultant
Real-Time Data Management @ Wipro Technologies