I.
Creating a Trend from in Excel
1) Open Excel and go to Developer r ibbon, click on Visual Basic
2) Go to Tools / References Menu ad add a reference to Aspen ProcessExplorer 3.0 Object Library
3) Add a form to the project
4) On Toolbox windows (it can be open from the View / Toolbox menu), right click on the tab and select New Page
5) On the New Page, click on any empty space and select Additional C ontrols
6) On the Additional control windows select Aspen Trend Plot and Aspentech TimeLine Control
7) Drag and drop from the Trend Icon to the Windows Form
8) Expand the new object to the desired size
9) Repeat step 7 and 8 using the TimeLine control; put this control below the Trend c ontrol on the form
10) Click on Play button, you should have a Form in Exce l which have the same basic functionality as a Process Explorer trend
II. Adding a tag programmatically
1) Starting from the previous example, drag and drop a CommandButton to the windows form, use the C aption option on the properties box for the button to change the text on it:
2) Double click on the button in the form to generate the OnClick event code
3) Copy the code below between previous two lines: Dim Tag, Map, Server Tag = "ATCAI" 'Change this for a your tag name Map = "IP_AnalogMap" 'Change this for your mapping record Server = "
" 'Change this for a dataspurce name TrendPlot1.TrendTags.Add Server, Map, Tag
4) Click on Play, the form will start running. By clicking on Add Tag button, it will add the tag name on code automatically:
III. Adding a Scooter programmatically
1) Starting from previous example, go to Tools / References Menu and add a reference to Aspen Trend Chart Library. If cannot find the reference on the list, browse it to the folder C:\Program Files (x86)\Common Files\AspenTech Shared\Apex and select TrendChart.ocx
2) Follow steps 1 to 2 to add another button to add a new scooter, change caption of the button to A dd scooter: 3) Copy this code between the lines of the second button click event Dim MyScooters As AtTrendCharts.Scooters Set MyScooters = TrendPlot1.Scooters Dim time As Date time = Now - (1 / 24 / 6) 'now minus 10 minutes MyScooters.Add time
3) Click on Play, the form will start running. By clicking on Add Scooter button, it will add the scotter 10 minutes before current time automatically:
IV. Calling the Form from Excel
1) Save the project from Excel Save menu
2) Close it an open it again. 3) Go to Developer tag, click on Insert and select Button (Form Control)
4) Draw the button on the Excel spreadsheet, after drawing the button a windows calling a Macro for this button will be displayed, click on New
(if you close this windows by error, it can be called again by right click over the button and select Assign Macro)
5) On the code screen, copy this code between the Button 1 Click event code: UserForm1.Show
6) Save the project and run it. Close the From open. Now by clicking over the Button in the Spreadsheet the form will be displayed.