Normally the sunroof is wired to a constant "hot" lead like the lead that powers the alarm (that way it "remembers" your button 1 and button 2 settings and can be closed with the ignition off). The wiring is usually routed down the drivers-side windshield pillar. Pop that off and make sure the wiring isn't pinched. Follow it down to see if it's wired in the fuse box (driver-side of dash) or the wire goes through a hole in the firewall. Look for an inline fuse if the latter as it may be popped (the wiring will probably come out a hole in the firewall then come across to the passenger's side under the hood until it connects to the battery. Look for any breaks or pinches in the wire.
Those units are fairly robust and it sounds like it's just not getting any power.
-- John