27 This efficacy, where there is question of the eucharistic sacrifice and the sacraments, derives first of all and principally from the act itself ( ex opere operato ). But if one considers the part which the Immaculate Spouse of Jesus Christ takes in the action, embellishing the sacrifice and sacraments with prayer and sacred ceremonies, or if one refers to the "sacramentals" and the other rites instituted by the hierarchy of the Church, then its effectiveness is due rather to the action of the church ( ex opere operantis Ecclesiae ), inasmuch as she is holy and acts always in closest union with her Head.
Source: Mediator Dei (Vatican.va)