procedure TMyWin.MenuFileSaveAs(var Msg: TMessage);
var
   i, reply : integer;
   fname : text;
   aCheck: Check;
   FileAttr  : Word;
begin
     if (not IsEmpty(CheckBook)) then begin
        StrCopy(FileName,'*.BRT');
        reply := Application^.ExecDialog(New(PFileDialog, Init(@Self, PChar(sd_FileSave), FileName)));
        if (reply = id_OK) then
           begin
{$I-}
               GetFAttr(FileName,FileAttr);
{$I+}
               if (IOResult = 0) then
                  reply := MessageBox(HWindow,'Overwrite File ?','File Exists',mb_OKCancel + mb_IconQuestion);
               if (reply = id_OK) then
                  begin
                       Assign(Fname, FileName);
                       ReWrite(Fname);
                       Writeln(fname, ListLength(CheckBook));
                       for i := ListLength(CheckBook) downto 1 do begin
                           Findith(CheckBook, i);
                           Retrieve(CheckBook, aCheck);
                           WriteCheckToFile(aCheck, fname);
                       end;
                       Close(fname);
                       isDirty := false;
                       isNewFile := false;
                       isSaved := true;                
                  end
           end                    
     end
end;