Thanks for the replies.
I tried again today to get the sunroof to set correctly, but, although I go through the routine, I still have the "Sunroof open" when I take out the ignition key.
Today, I went through the complete job - manually winding the glass fully open and then rewinding it fully closed. Run the motor backwards and forwards for about 20/30 seconds in each direction, first in the "Open" direction and then in the "Close" direction.
Reconnect the motor and then go through the setting cycle. At each point hold the switch down for a further 5 seconds. But when I test the operation of the sunroof it is kind of working correctly, in that the one press operation works and the sunroof opens and closes but when I take out the key and close the driver's door I still get the "Door open" message.
The motor definitely seems to rum correctly. It doesn't jump or stutter, or anything, when it operates. When I do the setting cycle and I hold down the switch for 5 seconds I can hear the motor click, which I presume to be the motor registering the position.
My big, big, big problem is - I don't know how the motor knows where the "Neutral" or "Closed" position is. I know that I keep asking this without, unfortunately, ever getting an answer, but surely there must be a "0" or "Start" position for the glass to be in before being operated.
There are a lot of generalisations regarding setting the sunroof and nowhere does anyone state where the glass has to be at the very beginning. Does the roof need to be in the fully open position first, or the fully closed position ?
I can't see that if the reset cycle is started with the glass half open, that the motor will recognise that it has to keep going backswards first, after all there are no actual switches in the cassette to trigger a message when the glass has reached the end of its cycle, either backwards or forwards.
The really frustrating issue here is that before I took out the cassette the sunroof operated OK. I haven't taken out or replaced any of the drive cable mechanics, just greased the tracks, while it was out. And retrimmed and refitted the sunshade.
I have had to adjust the height of the glass a few times but this is only to either set it slightly up or slightly down, in line with the vehicle roof [ as per RAVE instructions].
At the moment, I have the sunroof closed but only by manipulating it with the switch, a little bit up or a little bit down until it is in about the correct position.
Any advice or suggestions or information to solve this would be gratefully received as it is really driving me crazy. As it is positioned at the moment I am hoping that it is "waterproof" but as there has been no rain I can't tell. Hopefully rain is due tomorrow, and if all is OK it looks like I am going to just unplug the power switch cable from the motor and just leave it permanently closed.