Solomon was the most learned, richest, and possibly most powerful man in the world. He was smart enough to realize that his life and all lives had no meaning. Life was hopeless. People today try to avoid facing such a bleak reality by many distractions, addictions, and forms of escapism, but this "mad dash" only shows how desperate we are.
The only way to be saved from the impossible situation of life without hope is to be baptized into Jesus, receive a new nature and a new life, become sons or daughters of God, and members of the Church, the body of Christ, by which we share in the communion of saints. If we are living in and for Christ, every detail of our lives is charged with meaning and love. As sons or daughters of God and partakers in the divine nature (2 Pt 1:4), our very beings and all that we do is in Christ and in His body the Church. Thus, our selves and actions are taken up into the divine life, action, and infinite fulfillment of the Holy Trinity. Our lives enter into the mystery of God. Thus, the cry of the human race changes from "Vanity" to "Trinity."
Therefore, let us pray to live by faith this new life in the Trinity and to resist temptations to sin so that nothing will endanger our living this new life.