Noticed this it may help it's for a Passat:-
How-To: Resetting Sunroof "0" Position
If your sunroof refuses to close fully when the potentiometer is in the "roof closed" position, this is what you need to do:
Take off the sunroof motor cover.
Get the sunroof as close to the fully closed position as possible, either by messing with the switch a bit or using the "emergency operation" hex key located on the back of the sunroof motor cover. If you're using the key and the sunroof seems a bit hard to move, try pushing the key in a bit further. The sunroof should then become much easier to move.
Detach the sunroof motor. It is held in place with three T25 screws. One of the screws is a bit hard to reach, so if your Torx bits aren't long enough, you might be able to get by with removing only two screws.
With the harness still attached to the motor, turn the ignition on. If you weren't able to remove one of the screws in step 3, tilt the motor a bit so that it is able to move about freely. Cycle the sunroof switch through the following positions: roof tilted, roof closed, roof opened, roof closed.
Keep the ignition on and re-attach the motor. The Bentley manual discourages from re-using the screws, but I didn't see a problem with it. The torque spec is 3.5 Nm.
Test the sunroof operation. Everything should now be back to normal.
If you happen to be swapping the motor on a properly-working sunroof, make sure that: the ignition is off, a door is open, and sunroof is in the closed position. Otherwise, you'll have to reset the motor using the steps above.