Are people who die while excommunicated damned?
The short answer
Not necessarily. Excommunication mainly cuts a person off from the sacraments; it is not a sentence to hell but a medicine meant to bring repentance. One who dies before formal reconciliation can be saved if he truly repents of all his mortal sins before death.
For laypeople, excommunication chiefly means being cut off from the sacraments. It does not mean the Church condemns the person to hell. It is meant as a medicine to move people to repent and be reconciled; once reconciled, they may receive the sacraments again.
An excommunicated person who dies without formal reconciliation can be saved if he sincerely repents of all his mortal sins before death. We may certainly pray that such a person be interiorly reconciled to God and the Church through full repentance before death.