.... lcPath = SET([PATH]) SET PATH TO IF FILE(m.newfile) lnHndlr = FOPEN(m.newfile, 12) lnFor = 1 DO WHILE lnHndlr < 0 m.newfile = m.dir + [data\labels]+ALLTRIM(STR(lnFor)) + [.xls] IF FILE(m.newfile) lnHndlr = FOPEN(m.newfile, 12) ELSE lnHndlr = FCREATE(m.newfile) EXIT ENDIF lnFor = lnFor + 1 ENDDO ELSE lnHndlr = FCREATE(m.newfile) ENDIF SET PATH TO (lcPath) FCLOSE(lnHndlr) && Don't care abou of the action of open or creating the file is successful IF lnHndlr < 0 MessageBox([You don't have permissions to create a file) ELSE *** Excel SaveAS method ENDIF *** cleaning code