It sounds like the motor needs resetting. Check out this post http://www.benzworld.org/forums/w126-s-se-sec-sel-sd/1193701-malfunctioning-sunroof-switch.html
The post is a few years old and is in the W126 forum but the sunroof system is exactly the same. Read the first few posts as there are some further tips to my original instructions that will assist.
Good luck.