I have so many problems with my wagon's sunroof that I literally want it to be welded shut. At one point, I remember having the same problem as yours, and it turned out to be the sunroof guidelines, which were misaligned and did not let the sunroof operate normally nor close manually.
Parts were not bad for the repair, but labor was another subject.
Other repairs have included the cable, three relays and the motor itself. Don't even ask for the price of motor...
S 320, 1998
E 320 T, 1995