I am building a state machine whose actions and state transitions depend on a single input (click), and which object the input came from. In this case, the objects are all PowerPoint shapes.
Using a Christmas-tree of IF-THEN-ELSEIF... statements is ugly and hard to read.
Life would be much simpler if I could write:
Code: Select all
Function EventHandler
SELECT CASE Object
CASE IS Object1 ' using the classic VBA <object1> IS <object2>
...
CASE IS Object2
...
CASE ELSE
END SELECT
Also possible, but misleading and inelegant is:
Code: Select all
Function EventHandler(Object)
SELECT CASE TRUE ' TRUE? Why TRUE? where did that come from? you ask.
' Dunno, but zero causes weird results!
CASE Object IS Object1, Object IS Object2
...
CASE Object IS Object3
...
CASE ELSE
END SELECT
TIA for any insights.
Regards
Zk