vba - Can't Kill xls files -
i have been using every version of kill routines delete xls files in current directory no success. here code. want delete every xls file except wbcntl. stepping through code shows works exception of kill swb command. (swb public defined string)
'close files except wbcntl swb1 = wbcntl.name each wb in application.workbooks swb = wb.name if swb <> swb1 workbooks(swb).close savechanges:=false on error resume next kill swb err.clear end if next wb
can me this
i don't think application.workbooks
want. the excel 2003 vba help gives following meaning collection:
a collection of
workbook
objects open in microsoft excel application.
however, want iterate through excel files in current directory, different thing that.
i no means excel vba expert, don't take word without checking, but: imagine cannot delete files @ vba, because including macro such things in spreadsheet document considered many dangerous / potential security threat / virus.
Comments
Post a Comment