A person who is ill may be anointed at any time. The Church anoints people who are ill and in need of God's healing touch. If you know that you will be undergoing surgery or will be hospitalized, you may be anointed at the Church beforehand by contacting the parish office.
About the Sacrament
"Is any among you sick? Let him call for the elders [presbyters] of the Church and let them pray over him, anointing him with oil in the name of the Lord; and the prayer of faith will save the sick man, and the Lord will raise him up; and if he has committed any sins, he will be forgiven." ~James 5:14-15
"The Church believes and confesses that among the seven sacraments there is one especially intended to strengthen those who are being tried by illness. The Anointing of the Sick is not a sacrament for those only who are at the point of death. Hence, as soon as anyone of the faithful begins to be in danger of death from sickness or old age, the fitting time has already arrived to receive this sacrament." (CCC 1514)
"The Anointing of the Sick is a liturgical and communal celebration whether it takes place in the family home, a hospital or church, for a single sick person or a whole group of sick persons. It is fitting to celebrate it within the Eucharist, the memorial of the Lord's Passover." (CCC 1517)
"This sacred anointing of the sick was instituted by Christ our Lord as a true and proper sacrament of the New Testament. It is alluded to indeed by Mark, but is recommended to the faithful and promulgated by James the apostle." (CCC 1511)
"If circumstances suggest it, the celebration of the sacrament can be preceded by the sacrament of Penance and followed by the sacrament of the Eucharist." (CCC 1517)
The celebration of the sacrament includes the following principal elements the "priests of the Church, in silence, lay hands on the sick; they pray over them in the faith of the Church, this is the epiclesis (calling of the Holy Spirit) proper to this sacrament; they then anoint them with oil blessed, if possible, by the bishop." (CCC 1519)