+ Reply to Thread
Results 1 to 5 of 5

auto archiving functions

  1. #1
    Registered User
    Join Date
    08-20-2005
    Posts
    60

    auto archiving functions

    hi all
    just wanted to aks if there is any kinda of auto- fucntion that can archive a worksheet separatly wihout needing to save the acctual file.
    like i have "book1" and i add an entry then print the sheet but i dont want to save it cuz its a template-like but i want to have a record of it some where else with same date.
    like "book1 05-10-2005", "book1 06-10-2005" and so on to be saved in given path(folder).

    i know i can do this by "save-as" but then i must always give the file name over and over and i must choose where to save everytime.

  2. #2

    Re: auto archiving functions

    Hi Torpido.

    As far as I know there is not a function to do this. So you have to add
    a macro to your document.

    It could be something like this:
    '------Start
    Option Explicit

    Sub SaveCopyOfSheet()
    Dim strSaveAs As String
    Dim strInitial As String
    Dim strFilter As String

    ActiveSheet.Copy
    strInitial =3D "Book1_" & Format(Date, "yyyy_mm_dd") & ".xls"
    strFilter =3D "Excel (*.xls), *.xls"
    strSaveAs =3D
    Application.GetSaveAsFilename(InitialFilename:=3DstrInitial,
    Filefilter:=3DstrFilter)
    If strSaveAs <> False Then
    ActiveWorkbook.SaveAs Filename:=3D _
    strSaveAs, FileFormat:=3DxlNormal, Password:=3D"",
    WriteResPassword:=3D"", _
    ReadOnlyRecommended:=3DFalse, CreateBackup:=3DFalse
    ActiveWindow.Close
    End If
    If MsgBox("Close this document", vbQuestion + vbYesNo) =3D vbYes Then
    ThisWorkbook.Saved =3D True
    ThisWorkbook.Close
    End If
    End Sub
    '------------ END

    HTH

    Wouter Magr=E9


  3. #3
    Registered User
    Join Date
    08-20-2005
    Posts
    60
    thanks dude,
    will this macro auto-archive or i should set a key like f12 so it will save then.
    and cuz am not tyhat much in scripting can u tell me which parts to be replaced in this script.
    thanks, uve been help full.

  4. #4
    Registered User
    Join Date
    08-20-2005
    Posts
    60
    anybody?
    please

  5. #5

    Re: auto archiving functions

    Hi Torpido,

    There was a small typo in my code, sorry for that.

    About how to use:
    I suggest you copy it into the document from where you want to extract
    single worksheets.
    You either use [Alt]+[F8] to select this macro from the list and click
    Run...
    or you assign a hot-key to this macro.
    Hit [Alt]+[F8], Select the name of this macro, click Options and Select
    a key to use combined with [Ctrl] to start this macro.


    Sub SaveCopyOfSheet()
    Dim strSaveAs As String
    Dim strInitial As String
    Dim strFilter As String


    ActiveSheet.Copy
    strInitial = "Book1_" & Format(Date, "yyyy_mm_dd") & ".xls"
    strFilter = "Excel (*.xls), *.xls"
    strSaveAs = Application.GetSaveAsFilename( _
    InitialFileName:=strInitial, _
    Filefilter:=strFilter)
    If strSaveAs <> "False" Then
    ActiveWorkbook.SaveAs _
    Filename:=strSaveAs, _
    FileFormat:=xlNormal, _
    Password:="", _
    WriteResPassword:="", _
    ReadOnlyRecommended:=False, _
    CreateBackup:=False
    ActiveWindow.Close
    End If
    If MsgBox("Close this document, without saving", _
    vbQuestion + vbYesNo) = vbYes Then
    ThisWorkbook.Saved = True
    ThisWorkbook.Close
    End If
    End Sub


    I hoop that this will make you happy,

    Wouter


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1