determining the name of the variable to trigger the function
I would like to know how I can access the name of a variable that caused a function to be started. I have got several boolean variables (import-variables from some sensors) that can either be true of false. I also created internal variables to count how long these sensors are sending a "true"-signal. When they turn "false" again I want to reset that counter. My problem is that I don't know how to archieve that. All these variables refer to one single matrix. So inside that reaction-matrix I want to link a function for the case that the variable turns "false". I dont want to create one matrix for each variable because there are way too many. My idea was to create a function via vba that automatically determines the name of the variable that triggerd the matrix. Then I could use that name to change the value of the related count-variables (which have similar names). Can somebody here please help me with that?
Public Sub reset_count(obElem As Element)
Dim countVar As Variable
Dim sensorVar As Variable
Set countVar = thisProject.Variables.Item("[...Name from the Code...]")
countVar.Value = 0
This is a migrated post! Originally posted on 13.02.2020 by user Leon. Please be aware that information can be outdated.