+ Reply to Thread
Results 1 to 4 of 4

VBS for backup while saving word file

  1. #1
    Registered User
    Join Date
    11-13-2019
    Location
    Ploiesti
    MS-Off Ver
    2019
    Posts
    4

    VBS for backup while saving word file

    I have an excel that each time I save one more file is saved separately with the name of the respective file, to which is added the date and time of the save in the file name.
    I use the macro below for this.
    The same thing I would like to do for a word file, but I can't.
    Please help.
    Thanks.

    Please Login or Register  to view this content.
    Last edited by 6StringJazzer; 01-31-2020 at 08:15 AM. Reason: Moderator changed QUOTE tags to CODE tags

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBS for backup while saving word file

    It's not clear from your question but I am going to assume you want to do this for a Word file as a Word macro, not an Excel macro.

    One issue is that Excel has a SaveCopy method but Word does not. I have solved this problem in the past by saving the document, saving it with the new name, then re-opening the original. Also, the model in Word for handling a Save event is more complex than how it works in Excel. You can read that Microsoft page for details on capturing the event, then you can call the Sub below from it.

    A simpler option might be to use the Windows file system to make the copy, rather than saving as a copy. I have not tested this but it illustrates the approach.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    11-13-2019
    Location
    Ploiesti
    MS-Off Ver
    2019
    Posts
    4

    Re: VBS for backup while saving word file

    Not working

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBS for backup while saving word file

    I did test this and it turns out FileCopy will fail if the source file is open. I was able to get this to work. You will need to research how to capture the Save event in the link I provided above.

    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)

Similar Threads

  1. [SOLVED] VBA Code to disable only specific macro when saving backup file
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2016, 11:24 AM
  2. Saving a Backup as a Different File
    By Vlade777 in forum Excel General
    Replies: 2
    Last Post: 01-30-2014, 09:52 AM
  3. Saving Backup Copies before Updateing File
    By kjsconv in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2013, 09:12 PM
  4. Replies: 6
    Last Post: 03-07-2012, 04:56 PM
  5. [SOLVED] Why is Word, Excel saving a backup copy in my temp directory?
    By daddyribs in forum Excel General
    Replies: 1
    Last Post: 04-19-2006, 11:30 AM
  6. Saving backup file on file open
    By AmyTaylor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2006, 10:48 AM
  7. [SOLVED] Backup:always create a backup file in the save options
    By Alek in forum Excel General
    Replies: 1
    Last Post: 01-07-2006, 09:25 PM

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