The answer given to the above question by Ayatollah Hadavi Tehrani (may Allah grant him long life) is as under:
Although alcohol is ritually pure, it is forbidden to drink it. In case, however, there is alcohol in a foodstuff but the alcohol has evaporated and disappeared, there would be no problem in eating the food. That is to say, if the amount of alcohol existing in the food is so meager that it is generally considered as having no alcohol, there is no objection in eating that thing (food or drink). If indeed, there is 35% alcohol in vanilla extract, it is forbidden to eat it except for when it may have dissolved and disappeared in other ingredients. For example, if a little quantity of vanilla extract is used for cooking a lot of cakes and in the eye of 'urf (custom) it is not considered to be containing alcohol, it is permissible to eat the cake.