AnsweredAssumed Answered

Looping multistate tag values

Question asked by BobH on Jul 10, 2020

The following code in VBA processbook works...

 

Sub MyMacroNAS()

   If ThisDisplay.Value4.GetMultistate.CurrentState=0 then 

      VarNAS=1

      If wait then

         PlayWavFile…, False

      Else

         PlayWavFile…, True

      End If

    ElseIf ThisDisplay.Value4.GetMultistate.CurrentState=1 then

      VarNAS=0 

    End If

 

How would I cycle through multiple Tags... I know this wont work but just an example...

 

Sub MyMacroNAS()

 Dim x As Byte

  For x = 1 To 26

   If ThisDisplay.Value(x).GetMultistate.CurrentState=0 then 

      VarNAS(x)=1

      If wait then

         PlayWavFile…, False

      Else

         PlayWavFile…, True

      End If

    ElseIf ThisDisplay.Value4.GetMultistate.CurrentState=1 then

      VarNAS(x)=0 

    End If

   Next x

 

 

Thanks and have a great weekend

Outcomes