1 of 1 people found this helpful
As you said the best way of accomplishing it is by using ERD with AF in PI Processbook.
However if you need to do that by using VBA code, you can set the PI trend Properties as shown below:
Sub test() Trend1.RemoveTrace (1) 'Removes the current trace Trend1.AddTrace ("\\GCHERMONT-PI3\CDT158") 'Adds a new trace (server and tag names can be picked up from Text and Comboboxes Trend1.SetStartAndEndTime Format(DateAdd("n", -10, Now), "dd-mmm-yy hh:nn:ss"), Format(Now, "dd-mmm-yy hh:nn:ss") 'sets the new start and end time End Sub
Thank you so much for the codes, will try them out and update within a few days.