PC Review


Reply
Thread Tools Rate Thread

Auto Archive old file to a folder

 
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      26th Oct 2006
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 With Quote
 
 
 
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      26th Oct 2006
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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      26th Oct 2006
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

"(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      27th Oct 2006
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
>
> "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      27th Oct 2006
Thanks a lot Alan.


Mark

"(E-Mail Removed)" 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
> >
> > "(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      27th Oct 2006
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
>
> "(E-Mail Removed)" 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
> > >
> > > "(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      27th Oct 2006
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
>
> "(E-Mail Removed)" 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
> > >
> > > "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      28th Oct 2006
Hi Alan thanks a lot for the code, but I'm sorry I don't know how to write
this into VBA with regards to copying it into VBA, also the code I have is as
follows - Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel
As Boolean)
ActiveWorkbook.SaveAs Filename:="Galashiels Stock as of " & Format(Date,
"dd-mm-yy") & ".xls"
End Sub
I changed this to a daily basis as was creating a lot of files at the
moment, when workbook is active it will only be used approx 4-5 times a week.

With the current code how should I import the new code? I've not quite got
it when it comes to writing in VBA yet still new to it, If you could write
the code for me and e-mail to me again it would be much appreciated if that
ok,

Regards and thanks for all your help.


Mark

"(E-Mail Removed)" wrote:

> 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
> >
> > "(E-Mail Removed)" 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
> > > >
> > > > "(E-Mail Removed)" 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 With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      30th Oct 2006
Mark,

The two subs below (workbook_Open and Before_Close) may already exist
in your workbook module. If so, you need to copy the code in between
the first and last line of each sub in to your existing routines.
Otherwise, just copy the code as written below.

Sounds like the archiving won't be an issue for you. Post back if the
above is not clear.

This needs to be at the top of all code in the workbook module:

Option Explicit
Public LngNm As String
Public ShrtNm As String


Alan

santaviga wrote:
> Hi Alan thanks a lot for the code, but I'm sorry I don't know how to write
> this into VBA with regards to copying it into VBA, also the code I have is as
> follows - Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel
> As Boolean)
> ActiveWorkbook.SaveAs Filename:="Galashiels Stock as of " & Format(Date,
> "dd-mm-yy") & ".xls"
> End Sub
> I changed this to a daily basis as was creating a lot of files at the
> moment, when workbook is active it will only be used approx 4-5 times a week.
>
> With the current code how should I import the new code? I've not quite got
> it when it comes to writing in VBA yet still new to it, If you could write
> the code for me and e-mail to me again it would be much appreciated if that
> ok,
>
> Regards and thanks for all your help.
>
>
> Mark
>
> "(E-Mail Removed)" wrote:
>
> > 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
> > >
> > > "(E-Mail Removed)" 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
> > > > >
> > > > > "(E-Mail Removed)" 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 With Quote
 
=?Utf-8?B?c2FudGF2aWdh?=
Guest
Posts: n/a
 
      30th Oct 2006
Hi Alan,

I'm sorry i'm having problems writing the code into existing code with
reference to character spacing and enter etc. Getting errors compile errors
when closing and asking me to Debug but I don't know how to debug the code.


Thanks a lot for your help.


Mark

"(E-Mail Removed)" wrote:

> Mark,
>
> The two subs below (workbook_Open and Before_Close) may already exist
> in your workbook module. If so, you need to copy the code in between
> the first and last line of each sub in to your existing routines.
> Otherwise, just copy the code as written below.
>
> Sounds like the archiving won't be an issue for you. Post back if the
> above is not clear.
>
> This needs to be at the top of all code in the workbook module:
>
> Option Explicit
> Public LngNm As String
> Public ShrtNm As String
>
>
> Alan
>
> santaviga wrote:
> > Hi Alan thanks a lot for the code, but I'm sorry I don't know how to write
> > this into VBA with regards to copying it into VBA, also the code I have is as
> > follows - Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel
> > As Boolean)
> > ActiveWorkbook.SaveAs Filename:="Galashiels Stock as of " & Format(Date,
> > "dd-mm-yy") & ".xls"
> > End Sub
> > I changed this to a daily basis as was creating a lot of files at the
> > moment, when workbook is active it will only be used approx 4-5 times a week.
> >
> > With the current code how should I import the new code? I've not quite got
> > it when it comes to writing in VBA yet still new to it, If you could write
> > the code for me and e-mail to me again it would be much appreciated if that
> > ok,
> >
> > Regards and thanks for all your help.
> >
> >
> > Mark
> >
> > "(E-Mail Removed)" wrote:
> >
> > > 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
> > > >
> > > > "(E-Mail Removed)" 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
> > > > > >
> > > > > > "(E-Mail Removed)" 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get it to auto-archive to an already set-up folder in personal fol Christine Microsoft Outlook Discussion 2 30th Jul 2009 07:48 PM
Archiving solution for no Archive folder or archive.pst file Ace Kinkaid Microsoft Outlook Discussion 0 16th May 2008 03:16 PM
Auto Archive settings - one folder =?Utf-8?B?VGlt?= Microsoft Outlook Installation 0 6th Aug 2007 08:42 PM
Auto-archive a folder tree? Andrew Stickler Microsoft Outlook 3 9th Jan 2004 04:08 PM
OL2002 Auto Archive folder name Rich@MDOT_30Oct2003 Microsoft Outlook Discussion 4 31st Oct 2003 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:58 PM.