+ Reply to Thread
Results 1 to 6 of 6

Appending filename with date

  1. #1
    Registered User
    Join Date
    05-30-2005
    Posts
    8

    Appending filename with date

    I have a macro that runs an application, and creates new files with the results. I want to have the date (and if possible time) of the run in my file name. But I am not able to do this with the Date function as I guess the results it throws is not in the text format. How can I do this in VB? Right now, to do this, I am typing the date in "" in one of the cellls, but I am sure there would be better ways. Suggestions please.

    Thanks,
    Kapil

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Use in VBA

    myVar = Format(Now(), "dd mmm yy")

    Mangesh

  3. #3
    Registered User
    Join Date
    05-30-2005
    Posts
    8
    Thanks a lot. It works.

  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Thanks for the feedback

    Mangesh

  5. #5
    Bob Phillips
    Guest

    Re: Appending filename with date


    sFilename = "myFile-" & Format(Now,"yyyymmdd hhmmss") & ".xls"

    --
    HTH

    Bob Phillips

    "kapil.dalal" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I have a macro that runs an application, and creates new files with the
    > results. I want to have the date (and if possible time) of the run in
    > my file name. But I am not able to do this with the Date function as I
    > guess the results it throws is not in the text format. How can I do
    > this in VB? Right now, to do this, I am typing the date in "" in one of
    > the cellls, but I am sure there would be better ways. Suggestions
    > please.
    >
    > Thanks,
    > Kapil
    >
    >
    > --
    > kapil.dalal
    > ------------------------------------------------------------------------
    > kapil.dalal's Profile:

    http://www.excelforum.com/member.php...o&userid=23853
    > View this thread: http://www.excelforum.com/showthread...hreadid=375005
    >




  6. #6
    Andy Wiggins
    Guest

    Re: Appending filename with date

    This link might give you some ideas:

    http://www.bygsoftware.com/Excel/VBA/saving.htm

    --
    Andy Wiggins FCCA
    www.BygSoftware.com
    Excel, Access and VBA Consultancy
    Home of Excel Save and Backup
    -

    "kapil.dalal" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > I have a macro that runs an application, and creates new files with the
    > results. I want to have the date (and if possible time) of the run in
    > my file name. But I am not able to do this with the Date function as I
    > guess the results it throws is not in the text format. How can I do
    > this in VB? Right now, to do this, I am typing the date in "" in one of
    > the cellls, but I am sure there would be better ways. Suggestions
    > please.
    >
    > Thanks,
    > Kapil
    >
    >
    > --
    > kapil.dalal
    > ------------------------------------------------------------------------
    > kapil.dalal's Profile:

    http://www.excelforum.com/member.php...o&userid=23853
    > View this thread: http://www.excelforum.com/showthread...hreadid=375005
    >




+ 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