It has been rare. But it does have a proper time and place. Proper use of public declarations of excommunication is to send clear messages to the faithful - including to the excommunicated themselves.
For example say there was a prominent and influential Catholic, say a United States Senator, who publically and repeatedly violated Church teaching on abortion. Say this Senator also publically traded on his membership in the Catholic Church. Say he was widely observed by fellow Catholics to be allowed to participate in the sacraments, and regularly meet on friendly terms with priests and bishops. The scandal this would cause is that the Church officials in question would be seen as accepting, or even condoning behavior that clearly violated Church teaching - whether they intended such a message or not. It would cause many of the faithful to believe that such behavior did not violate Church teaching after all.
This is exactly what has happened, and continues to happen today. On abortion, and a whole host of issues, one can observe prominent and influential Catholics defying Church teaching without consequence. That sends a powerful message that depersonalized statements, however orthodox, cannot entirely dispell.
The overall effect has been to dilute the moral authority of the Church. Catholics now openly defy the Church without feeling the least bit uncomfortable, nor the least bit less Catholic. There are plenty of examples of prominent Catholics defying he Church in exactly the same way while yucking it up with the bishops. Why should an average person who's bishop scarcely notices him be concerned?
Oh, I don't want to be arguing against it, per se. In my earliest post on this thread I was calling for excommunications, and I'd like to see a couple. But I would hesitate before saying the failure to pronounce excommunication was . . . a failure.