Right after the Sub( ) line at the top, add this line to declare a
variable that holds your workbook name:
Dim CurrentFileName as string
CurrentFileName = activeworkbook.name
Then change
ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\Book1.xls",
.... to this:
ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\" & CurrentFileName,
Note this changes your default directory to C:\IDSC\Archived, and the
active sheet, now on your screen, is your archive copy. This leaves
you open to inadvertently changing your archive copy, or treating it as
your main version. If that's not OK, let us know and we can add code
to get it to work to your specifications.
|