Vitamin D will help but it is not the only beneficial compound produced by our skin in the presence of sunlight. Strategic tanning bed/booth & Vitamin D supplementation works best imho.
There seems to be attitional benefits to the sunlight induced vitamin D production, possibly related to the oxidation of cholesterol & sulphur as the cholesterol is converted into Vitamin D.