Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi Want to save workbooks into archive when finished with i went through the
manual mode and would like to know, What do I have to change in this code so it keeps the current file name etc greg.xls so on and so on. ChDir "C:\idsc\archived" ActiveWorkbook.SaveAs Filename:="C:\idsc\archived\Book1.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False Range("G3").Select End Sub \ Thanks in advance Greg |
#2
![]() |
|||
|
|||
![]()
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. |
#3
![]() |
|||
|
|||
![]()
Thanks for that works great
Greg |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
change directory for refresh data | Excel Discussion (Misc queries) | |||
Saving shared Excel files | New Users to Excel | |||
How do I insert the directory path in my Excel file? | Excel Worksheet Functions | |||
Opening and saving Excel 2003 file from Excel 97. | Excel Discussion (Misc queries) | |||
Error Message appearing when saving a file | Excel Discussion (Misc queries) |