Hello Everyone,

I have a group of objects in PI-PB display where I applied multistate for all of them using PI calculation, so if the value of my calculation is less than 10% the object will turn green, if its greater than 10% the object will turn red. Now is there a way to get the color of the current status for each one of them in VBA macros, because I need to make an automatic counter that count how many objects in green and how many are in red.

I tried to use the GetMultiState property in this way:

If ThisDisplay.Shorthorizontalpipe_13.GetMultiState.CurrentState = 65280 Then

countDP1G = countDP1G + 1

But it didn't work properly, so if anyone can guide me to the correct way it will be great.

Thanks,

Israa

Thank you Tim for your reply.

I tried this and it worked:

If Pipe_13.GetMultiState.CurrentState = 0 Then ' 0 is the first state (in my case green color)

countDP1G = countDP1G + 1

ElseIf Pipe_13.GetMultiState.CurrentState = 1 Then ' 1 is the second state (in my case red color)

countDP1L = countDP1L + 1