Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Need help. I have an excel document that updates date and time everytime
you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
By archiving, you want to MOVE yesterday's file to the archive when the
new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes thats correct Alan, or move the one that is old in comparison to date and
time as I have the file set up to auto update date and time. Thanks, your a great help. Mark " wrote: By archiving, you want to MOVE yesterday's file to the archive when the new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark,
I have some code on my office pc I will post tomorrow. Alan santaviga wrote: Yes thats correct Alan, or move the one that is old in comparison to date and time as I have the file set up to auto update date and time. Thanks, your a great help. Mark " wrote: By archiving, you want to MOVE yesterday's file to the archive when the new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot Alan.
Mark " wrote: Mark, I have some code on my office pc I will post tomorrow. Alan santaviga wrote: Yes thats correct Alan, or move the one that is old in comparison to date and time as I have the file set up to auto update date and time. Thanks, your a great help. Mark " wrote: By archiving, you want to MOVE yesterday's file to the archive when the new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark:
Here is some code that should work. Place all in the Workbook module. If you already have a BeforeClose and Open event, just add the code to your existing procedures. Change "P:\My Documents\Temp\" to your archive path. A few thoughts; Be sure all users have access to the archive path or they will get a file path error when closing the workbook. Also, your other post dealt with a file name that included a time stamp down to the second. Not sure how often the current copy of the workbook is updated and saved but, you could end up with a lot of archived files in a very short time. frame. Alan Public FrmNm As String Public ToNm As String Private Sub Workbook_BeforeClose(Cancel As Boolean) ToNm = "P:\My Documents\Temp\" & ToNm Name FrmNm As ToNm End Sub Private Sub Workbook_Open() FrmNm = ThisWorkbook.FullName ToNm = ThisWorkbook.Name End Sub santaviga wrote: Thanks a lot Alan. Mark " wrote: Mark, I have some code on my office pc I will post tomorrow. Alan santaviga wrote: Yes thats correct Alan, or move the one that is old in comparison to date and time as I have the file set up to auto update date and time. Thanks, your a great help. Mark " wrote: By archiving, you want to MOVE yesterday's file to the archive when the new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mark:
Here is some code that should work. Place all in the Workbook module. If you already have a BeforeClose and Open event, just add the code to your existing procedures. Change "P:\My Documents\Temp\" to your archive path. A few thoughts; Be sure all users have access to the archive path or they will get a file path error when closing the workbook. Also, your other post dealt with a file name that included a time stamp down to the second. Not sure how often the current copy of the workbook is updated and saved but, you could end up with a lot of archived files in a very short time. frame. Alan Option Explicit Public LngNm As String Public ShrtNm As String Private Sub Workbook_BeforeClose(Cancel As Boolean) If ThisWorkbook.Name = ShrtNm Then Exit Sub Else ShrtNm = "P:\My Documents\Temp\" & ShrtNm Name LngNm As ShrtNm End If End Sub Private Sub Workbook_Open() LngNm = ThisWorkbook.FullName ShrtNm = ThisWorkbook.Name End Sub santaviga wrote: Thanks a lot Alan. Mark " wrote: Mark, I have some code on my office pc I will post tomorrow. Alan santaviga wrote: Yes thats correct Alan, or move the one that is old in comparison to date and time as I have the file set up to auto update date and time. Thanks, your a great help. Mark " wrote: By archiving, you want to MOVE yesterday's file to the archive when the new file is saved, correct? santaviga wrote: Hi Need help. I have an excel document that updates date and time everytime you save it, what can I do to archive the old file to a different folder. e.g. Archived Data. So when I save the file it asks to replace, I click yes, the file is saved in original destination and the old file now is moved to Archived Data Folder. Anyone help me Thanks Mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do you archive a file | New Users to Excel | |||
Save file in a new folder, but create folder only if folder doesn't already exist? | Excel Programming | |||
Auto Archive LIne Items in Excel Worsheet | Excel Discussion (Misc queries) | |||
Auto Search Archive files | Excel Programming | |||
row archive and auto email | Excel Programming |