# Generate a Pascal Unit

You can generate source code for a Pascal unit and save it to disk as follows.

1. Select the snippets you want to include in the unit. The easiest way to do this is to use the toolbar button (or select Search | Select Snippets) then select the routines you require in the Select Snippets dialogue box. (Note that you can also select snippets using any of the program's search options – see the Search Database task for more information).
2. Click the toolbar button or choose the File | Save Unit menu option.
3. Enter the name of the unit in the Save Unit dialogue box. Ensure that the file name you select (without extension) is a valid Pascal unit name.
4. Choose the file type, the commenting style and whether you want the file to be syntax highlighted by using the controls in the dialogue box. You can use the Preview button to preview the unit. Note that syntax highlighting is only available for HTML and RTF file types.
5. Click OK to generate the unit.

See the Save Unit dialogue box help topic for detailed information about all available options.

Whether certain warnings are inihibited in the generated code can be specified using the Code Generation page of the Preferences dialogue box. The default commenting style, syntax highlighting and file type can be also be configured using the Code Formatting tab.

Freeform snippets cannot be included in a unit. Any freeform snippets included in the current selection will be ignored.