Just thinking, but using CallButton() inside a StartUndo()/EndUndo() context could have strange consequences, as it most likely does its own StartUndo()/EndUndo() implicitly. In best case one will simply end up with multiple undo steps, in worst case a corrupted undo stack will be the result. Unfortunately there's no easy way around this (you could do the selections manually) or skip the StartUndo()/EndUndo() calls.