Steve.Buckley

Using SDK and VBA to get both DigitalState Code and Name from a digital state tag?

Discussion created by Steve.Buckley on Mar 12, 2014
Latest reply on Dec 19, 2019 by YashLunawat
With Excel 2010 VBA, I am successfully using PISDK.Server.point.Data.RecordedValues to return a PIValues collection for a digital state tag.  In my 'for each piVal in PiValues' loop, I can retrieve the .Name value as Str = piVal.Value.  But I want to get the numeric Code# of the digital state tag as well. Tech Support found some VB.Net code that uses the following: int = DirectCast(pival.Value, DigitalState).Code Str = DirectCast(pival.Value, DigitalState).Name However, VBA does not have a DirectCast function, or any equivalent I can find that can get the .Code integer value.  Any thoughts?

Outcomes