It doesn't work for everyone, you either are sensitive to light in that way or you are not. I think about 18 - 35% of humans have this reflex.
For me it works extremely well, like if I go outside on a sunny day I will damn near always sneeze a few times when I first see the sun.
It also helps when I feel like sneezing and it won't come out, I only have to look towards the sun or a bright lamp and I'll sneeze.
It's not really known why this reflex develops or why some ppl have it and others do not, it can also be inherited.