filename=docname if value=1 then if not(isnull(filename)) and filename<>'' then xlapp.Application.ActiveWorkbook.SaveAs(FileName) xlapp.Application.ActiveWorkbook.close else messagebox("","The action is cancle") xlapp.Application.ActiveWorkbook.close end if end if