+ Reply to Thread
Results 1 to 3 of 3

Saving file with date on it

  1. #1
    Registered User
    Join Date
    01-16-2006
    Posts
    2

    Question Saving file with date on it

    Hi ,
    what macro do ineeed to create if i need to save my workbook with the date mentioned on one of the cells in that rec and the filename.

    for example if i have mentioned the date as 17th Jan06 on one of the cells than i want the macro to save my file at a particular place in my drive with the date featuring in the filename like "File011706.xls". ie it shud automatically identify the date and save my file.

    any help appreciated
    Anand

  2. #2
    Gary Keramidas
    Guest

    Re: Saving file with date on it

    change the location of the date, "a1" in my code and the file path, fpath in
    my code. if you don't use the username\my documents location, you can remove
    the uname variable


    Option Explicit
    Sub save_File()
    Dim fPath As String
    Dim FilePre As String
    Dim FDate As String
    Dim UName As String

    UName = Environ("UserName") & "\"
    fPath = "C:\Documents and Settings\" & UName & "My Documents\"
    FDate = Format(Range("a1"), "mmddyy")
    FilePre = "File"
    ActiveWorkbook.SaveAs fPath + FilePre + FDate
    End Sub


    --


    Gary


    "mehta_agm" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi ,
    > what macro do ineeed to create if i need to save my workbook with the
    > date mentioned on one of the cells in that rec and the filename.
    >
    > for example if i have mentioned the date as 17th Jan06 on one of the
    > cells than i want the macro to save my file at a particular place in my
    > drive with the date featuring in the filename like "File011706.xls". ie
    > it shud automatically identify the date and save my file.
    >
    > any help appreciated
    > Anand
    >
    >
    > --
    > mehta_agm
    > ------------------------------------------------------------------------
    > mehta_agm's Profile:
    > http://www.excelforum.com/member.php...o&userid=30518
    > View this thread: http://www.excelforum.com/showthread...hreadid=502358
    >




  3. #3
    Norman Jones
    Guest

    Re: Saving file with date on it

    Hi Arnand,

    Try:

    '=============>>
    Public Sub Tester01()

    Dim sStr As String
    Const sDateCell As String = "A1" '<<=== CHANGE
    Const SPath As String = "C:\MyFolder\" '<<=== CHANGE

    sStr = Format(Range(sDateCell), "mmddyy")
    ThisWorkbook.SaveAs Filename:=SPath & "File" & sStr, _
    FileFormat:=xlWorkbookNormal

    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "mehta_agm" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Hi ,
    > what macro do ineeed to create if i need to save my workbook with the
    > date mentioned on one of the cells in that rec and the filename.
    >
    > for example if i have mentioned the date as 17th Jan06 on one of the
    > cells than i want the macro to save my file at a particular place in my
    > drive with the date featuring in the filename like "File011706.xls". ie
    > it shud automatically identify the date and save my file.
    >
    > any help appreciated
    > Anand
    >
    >
    > --
    > mehta_agm
    > ------------------------------------------------------------------------
    > mehta_agm's Profile:
    > http://www.excelforum.com/member.php...o&userid=30518
    > View this thread: http://www.excelforum.com/showthread...hreadid=502358
    >




+ 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