I answer that, As stated above (Question [24], Article [12]; Question [110], Article [4]; Question [112], Article [2]), a sin is mortal through being contrary to charity. Now the sin of vainglory, considered in itself, does not seem to be contrary to charity as regards the love of one's neighbor: yet as regards the love of God it may be contrary to charity in two ways. In one way, by reason of the matter about which one glories: for instance when one glories in something false that is opposed to the reverence we owe God, according to Ezech. 28:2, "Thy heart is lifted up, and Thou hast said: I am God," and 1 Cor. 4:7, "What hast thou that thou hast not received? And if thou hast received, why dost thou glory, as if thou hadst not received it?" Or again when a man prefers to God the temporal good in which he glories: for this is forbidden (Jer. 9:23,24): "Let not the wise man glory in his wisdom, and let not the strong man glory in his strength, and let not the rich man glory in his riches. But let him that glorieth glory in this, that he understandeth and knoweth Me." Or again when a man prefers the testimony of man to God's; thus it is written in reproval of certain people (Jn. 12:43): "For they loved the glory of men more than the glory of God."
In another way vainglory may be contrary to charity, on the part of the one who glories, in that he refers his intention to glory as his last end: so that he directs even virtuous deeds thereto, and, in order to obtain it, forbears not from doing even that which is against God. In this way it is a mortal sin. Wherefore Augustine says (De Civ. Dei v, 14) that "this vice," namely the love of human praise, "is so hostile to a godly faith, if the heart desires glory more than it fears or loves God, that our Lord said (Jn. 5:44): How can you believe, who receive glory one from another, and the glory which is from God alone, you do not seek?"
If, however, the love of human glory, though it be vain, be not inconsistent with charity, neither as regards the matter gloried in, nor as to the intention of him that seeks glory, it is not a mortal but a venial sin.