View Full Version : VBA with PI Datalink

09-24-2012, 11:09 AM
Iím running Excel 2007 with PI Datalink 4.2. I have created a form that allows the user to select the different tagnames that they would like to see their historical data for. VBA then takes these tagnames and pastes them into the appropriate cells that the PI Datalink Sample Data Field (PISampDat) needs them to be in.

Iím using a dynamic range name that references all the tagnames selected by the user.

My issue is that the Sample Data Field converts the dynamic range to its the absolute range (ie $A$1:$D:$1). It loses the dynamic functionality.

Does anyone have a way to get around this? Is there a way that VBA can set the Tagname field in Sample Data form? Or, is there a way to make it so Sample Data stops converting my dynamic name ranges into absolute cell references?

Thanks for any and all help...


09-24-2012, 01:45 PM
How did you define the dynamic range ?
Please post a sample 'form' ( userform ? worksheet ?)
What code do you apply ?

09-25-2012, 12:21 PM
Without the PI Plug-in it's difficult to show this.

Attached is a picture.

If I point the PI Datalink User Input Data Form to a cell that has a dynamic range in it, say cell B6, the PI Plugin convert the dynamic range to an absolute range.

If the user selects more tags the dynamic range name, using an offset formula, adjusts to the number of tags but the PI User Input Data Form retains the previous absolute range and does not "expand" to grab the additional tags.

I think I need a way to populate the PI Datalink User Input Form tagnames field with an absolute range - which would equate to the dynamic range.

Not sure how to write the range into the Tagname field of the PI Datalink Plugin though.