If you have a 740 with an electric sunroof, when the roof is in the fully closed position you should be able to push the closed switch again and have the rear of the roof pop up to the 'vent' position. If you have a manual roof, after it reaches the closed position you feel a bit of resistance; you then continue moving the crank in the closed direction and the rear of the roof should pop up to the 'vent' position.
If your roof does not move at all, you must NOT pry up the rear edge manually as there are cast tracks at the rear of the panel that hold it in place and you will break, bend, or damage the tracks, roof or the panel.
Most likely it is out of alignment and too tight for the minimal leverage applied by the motor to move it, as well as being thoroughly gunked up. The secret to lack of motion is most likely binding in the up and down motion of the panel. If manual, try moving the crank back and forth, bearing in mind that the first motion the roof makes is that up and down motion at the rear of the panel. If there is resistance to the crank motion immediately, there is 'likely' to not be any damage in the screw mechanism, just binding of the panel in the roof.
If nothing moves as you move the crank towards 'vent', push up gently through that small rectangular opening inside the headliner on the rear of the panel to help it along, by just pushing it free of the roof. The tracks at the rear of the panel move the panel up and down, either to pull it down before retracting or to pop the rear of the panel up for the 'vent' position, and if they are damaged or too gunked up, they will resist opening. The device that is connected to the motor/crank via screw cables slides back and forth in these tracks, raising and lowering the panel, which will not be possible unless you can move the crank/motor. Try to get it high enough to be able to peer inside the roof from the outside to unhook the headliner clips - once you get those, all is revealed and you will be able to see why your roof is not functioning properly.
Try a few links to help further:
BMW Sunroof Removal and Repair Wayne Dempsey
Great now my sunroof wont close TDIClub Forums
Club Scion tC
Sunroof problems Mercedes Benz Club of America