There was a recent case in Spain where the Cardinal did not
defrock the priest, but the priest actually ex-communicated himself by his heresies... He actually wrote a book about defying the Catholic Church.
That priest in Spain has been out... By his actions...
Excommunicating oneself is akin to a tree falling in the forest and no one hears it.
Public and formal excommunication is the answer.