skip to content

How do I RUN a PI Datalink formula from within a vb macro/function?

I would like to execute a PI Datalink formula (for example, PICalcDat()) from within an Excel vb function. Is this possible? Is this allowed?? After RECORDING a macro and going thru the strokes of manually typing in the PICalcDat() formula (i.e. filling in the user input box), there is NOTHING in the macro after entering formula and stopping the macro record. ... Using the "Worksheet.Function.Macro()" vb command does NOTHING and "Application.Run PICalcDat()" does NOTHING. Maybe this is supposed to be BLOCKED (??) ... Any help is greatly appreciated. Thanks!

This isn't a direct answer

This isn't a direct answer to your question (because I don't know the answer) but it is possible to use the PI-API or PI-SDK in VBA - Excel, Access, Outlook - to get the same values that a PICalcDat cell formula would give.
And, of course, it's possible to use Excel's .Formula method to create a Datalink formula in a cell (or Range, if you need more than one value returned from  PICalcDat), but either of those is a lot of heavy lifting compared to what you are asking for.  On the other hand, they will work...
jhCox

Powered by Drupal. CrystalX theme created by Nuvio | Webdesign.