If you think it is the switch, here is your easy test for it.

Lower the front edge of the headliner at the sunroof opening (should just have to loosen or remove the rubber trim piece around the...