First things first, welcome to the forum.
Please add your year and trim of your vehicle to your signature line. That way when you start asking questions in other areas of the forum, we all have a better idea on how to assist you. Click on "Quick Links" above, go down to "User Control Panel" and then click on "Edit your Signature" It'* pretty straight forward from there.
Oh yeah and can you be a little more specific in the description of your problem. When does it click opening /closing? does it sound like its coming from the sunroof track or from the control panel, you know things like that.
2000 Bonneville SSEi aka "Eva"
"Everybody is fast in a Bonneville"