After seeking out wisdom, and finding it unsatisfying, it is often a natural tendency of a seeker to go out after pleasure. Pure pleasure, mirth, as a way to fill your heart. Solomon did this after finding wisdom unsatisfying, but this too is vanity.
The pursuit of pleasure in life is always vanity, because you will never have enough of it. You will be unable even to enjoy what pleasures you are having at this time. Even in the midst of some great joy, you will be busy thinking about and desiring some future joy. You may be in the arms of someone you love, emotionally or sexually, and meanwhile you are thinking about some future date when you might get married to this person. Or maybe you're already thinking of someone else. You can't stay where you are and enjoy what is right before you.
But the pursuit of pleasures becomes especially futile after one has begun to pursue wisdom. It is very natural, most seekers do it at some time, to 'give up' , and decide that the only purpose in life is to enjoy yourself and seek out pleasure. Really there is no true giving up involved here, you are not dropping anything, you're just shifting your desire from the pursuit of knowledge or wisdom or truth to the pursuit of sensual pleasures. But the fundamental longing is still there. Solomon describes seeing people laughing in merrymaking, and knowing what he knows, finding it mad. Often we start to laugh when we are trying to deeply repress or deny some reality, we will start to make jokes or wisecracks when someone confronts us with a truth we don't want to hear. For someone who has had a taSte of wisdom, the pursuit of pleasure will seem fruitless. What doeth it, asks Solomon, where does it get you? Nowhere. So for one who seeks to get somewhere, to gain something, this is no answer. Study these words carefully, and understand.
Solomon sought to lose himself in wine. This has a double meaning. On the one hand, Solomon consciously had tried all he knew, and being in deep depression, desired to try to deaden his consciousness through alcohol. Remember that while there are a few substances that, used properly, can help to expand one's awareness, for the most part the use of drugs is something people apply to deaden their awareness, to deny it. But in this case the wine has a different meaning. Wine has been a symbol for the divine in the middle east since time immemorial. The Sufis are the most famous for applying this symbol, but here Solomon is doing the same thing. He is saying that even in the midst of his disillusionment, his deeper awareness sought to fill himself with the divine. That is the ultimate longing, the reason we pursue our other desires, to try to fill ourselves. But it is something that only the divine can satisfy.
But Solomon could, at this time, neither deaden himself nor raise himself. Instead, he did what most people do, he tried to fill himself through works. He built great things, and he filled his life with all the possessions he could, and with all the pleasures he could. Most people lack the ability or courage to jump into the divine, or the lowness of awareness needed to plummet into self-annihilation. Instead, they take a 'safe' course, trying to live as part of the world, trying to do their job, and get some things, and make themselves as comfortable as possible.
But finally, Solomon looks at all the work he's done, and finds that there is nothing there that can satisfy. It is pointless, folly. It vexes the spirit, it leaves your spirit unfilled. It is a waste of your life. There is no profit to be had from it, because all you think you gain you will lose, and you will have gained nothing of what can truly be had.
Solomon was a King. He had the resources to do not normal work, but great work! To pursue not normal pleasures, but great pleasures! If he could not fill himself with his power and might, then no average man living an average life could do so. Often it is easier for someone living in a high level of materialism to realize the mystical then it is for someone who is poor. This is because the poor can always think, in the back of their head, that if they just had wealth, or more things, they would be happy. A rich man knows that's not true. Solomon, Buddha, and Krishna, three of the great masters, were all kings, and there were others as well. It takes a more exceptional person of lesser means, to understand the same thing. For a king it is easier to see how wealth brings you nothing.
Solomon says that wisdom excels folly as light excels darkness. Many have taken this to mean that wisdom is far better than folly. But if you read the verses that follow, you will see this is not what he meant. He only meant that wisdom lets you see what is happening, it does not change anything else. Light and darkness are only different, one is not truly greater than the other. Both come to an end. Likewise, to be wise does not allow you to escape death. The wise man and the fool, the same thing happens to both. Both will die.
So Solomon came to hate life, and what he perceived as unfair about it. No matter how hard he looked, he could not find a way that did not end in vexation and vanity. There was no way to escape this reality.
Solomon was indeed followed by lesser men, who ended up destroying all he built up. No matter what you accomplish, not only can you not take it with you, you also cannot control where it will go. Even the works of masters, even mystery schools, are guaranteed to become false and corrupt at some point after the master is gone. Sometimes very slowly, other times fast, but it is certain to happen.
Even to fill yourself with grief is a vanity. There is nothing to gain from it. It would be easy to feel sorry for yourself, for your state, but what comes of that? It only serves to help you feel a certain kind of good; if you can't get what you want, at least you can make a point of being bitter over it, of crying out to people or to the world, or to God, in the hopes of getting attention for it. You can come to feel that nothing is your fault, that you can be free at least of responsibility. This path leads to deadening, it goes nowhere. It too is vanity.
Solomon explains how one can also fantasize that there must be a judgment, that sometime in the future God will make up for your suffering, and punish those who have wronged you. But of this he says it is also vanity. Anything that leads you away from the hereunto is vanity. What Solomon calls the 'hereunto' is what I call the moment. This is what we have, and this is where we can find fullness. The other things Solomon has listed, the vanities, are vanities because they cannot fill you. And they cannot fill you because in fact they become your very obstacle. By pursuing these other things, by seeking wisdom or knowledge or pleasure, or by feeling sorry for yourself, or by seeking to deaden yourself, you cannot appreciate what you do have: this moment, the hereunto. So what can you do? You can do nothing better than to eat and drink, make your soul enjoy the good in your work. It is what you can benefit from, not others, and it does not fail. It is its own reward. If you can eat, drink, work, live, not for some further goal or desire, but for its own sake, then this will be your reward.