+ Reply to Thread
Results 1 to 8 of 8

Macro to Save file with date/time stamp

  1. #1
    Registered User
    Join Date
    03-29-2007
    MS-Off Ver
    365
    Posts
    70

    Macro to Save file with date/time stamp

    Hi all VB Experts,

    I have a file located at C:/Report.xls

    I would like to have a VB code that can first save file at this location. Meanwhile, an extra copy will be saved under C:/Archive/ . The second file needs to be saved with Date and Time stamps.

    Thanks...

  2. #2
    Forum Contributor
    Join Date
    04-21-2007
    Location
    Lima, Peru
    MS-Off Ver
    2000, 2007, 2010
    Posts
    674

    Archive file copy

    Hi

    Attached is an example for you to try.

    When closing the file it will automatically be saved at its current location, then a copy will be saved in the directory "Archive", this will be created automatically if it does not exist.

    The code is in "This Workbook" and can be amended as necessary.

    Regards

    Jeff
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    03-29-2007
    MS-Off Ver
    365
    Posts
    70
    Thanks. but...

    I do not want to put the file path, date and time on the worksheet. I want to code the path in the VB code,and save the file at the path with current date/time stamp...

  4. #4
    Registered User
    Join Date
    09-02-2008
    Location
    Richmond
    Posts
    71

    Try this

    TT388

    I built something like that, try the code

    I hope this helps

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-29-2007
    MS-Off Ver
    365
    Posts
    70
    James580

    Thanks. It is close. But I do not have the file name on the my spreadsheet. I want to save a copy using the orginal file name and adding date adn time stamp. For exmaple,

    original file location C:/Report.xls
    acrive copy location C:/Report/Archive/Report_YYYYMMDDMMSS.xls

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Registered User
    Join Date
    03-29-2007
    MS-Off Ver
    365
    Posts
    70
    royUK,

    Thanks. There is an error when I run the script.

    Run-Time error 13, Type mismatch

    VBE shows an error on this line:

    Please Login or Register  to view this content.
    Last edited by royUK; 10-31-2008 at 09:13 AM.

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this
    Please Login or Register  to view this content.

+ 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