Save the file while perform close operation

Hi

Good morning to all,

i need a code for save the file while i click the close button. if i give the file name for save it saved but i cant view the file. then again i give the same name is doesnot check whether already that file name is present or not. so can any one help for those two problems 1.close the file. 2. ask to save or not.

Regards,

V.Sankar

SolidworksApi macros