just a note,
remove the "While IsMoving(), Wend" statements from your activate and deactivate signals they are pointless there. The while is moving is for Movement type coded commands, i.e. Code "Gxx ...." it is used when you want to wait for the machine to move, this includes the G4 codes.
scott