Upvote:3
St. Thomas Aquinas addresses the question of "Whether a man can excommunicate himself, his equal, or his superior?" in his Summa Theologica suppl. q. 22 a. 4 c.:
Since, by jurisdiction, a man is placed above those over whom he has jurisdiction, through being their judge, it follows that no man has jurisdiction over himself, his superior, or his equal, and that, consequently, no one can excommunicate either himself, or his superior, or his equal.
Upvote:8
There is no such thing as voluntary excommunication, in the strict sense of excommunication. There's a good answer by AthanasiusOfAlex which explains the purpose of excommunication; I'll restrict this answer to method, as asked by the question. However, the other answer is valuable in demonstrating that "voluntary excommunication" is absurd.
Excommunication is either latae sententiae (imposed by the unlawful act itself) or ferendae sententiae (imposed by authority).
Neither of those methods of excommunication is voluntary. An act which incurs a latae sententiae excommunication may be voluntary, but the excommunication is not.
If what you are actually asking is about a formal secession from the Church, then yes, any act of formal secession will result in a latae sententiae excommunication: canon 1364 specifically mentions apostasy, heresy and schism.
Canon 1365 prescribes a "just penalty" for prohibited participation in religious rites. Canon 1369 prescribes a "just penalty" for public blasphemy, harming public morals or exciting hatred of, or contempt for, religion or the Church. A "just penalty" could include excommunication, but it will be ferendae sententiae.
All of these acts will be voluntary, but the resulting excommunication is not.