How to \input the part between \begin{document} and \end{document} from another LaTeX file?

Sometimes I want to \input some LaTeX code, which belongs to a standalone LaTeX file.

I would like to input the part between \begin{document} and \end{document}, while skipping the other part.

-
With “standalone” LaTeX file, do you mean that you are using the standalone document class? – Caramdir Jun 27 '11 at 9:29

For this you only need to load the standalone package and then simply \input the other file. The standalone class is not required, but useful for the other file if it is a diagram or similar which you want to compile on its own with minimal borders. – Martin Scharrer Jun 27 '11 at 10:41