Save dialog box

Save / Save As dialog box if file is not save before closing.
How can I achieve above?

put code in the CancelClose event do to save if needed there.

You willl find code and explanations there: