No. This was answered above.
You can make a macro that will cast Flash of Light, but will cast Word of Glory when you hold shift. You can make a macro that will cast Word of Glory, then Flash of Light. You can’t make a macro that will miraculously decide for you whether or not you are able to cast Word of Glory and then choose the appropriate spell.