+ Reply to Thread
Results 1 to 11 of 11

Excel VBA Backup Process Backing up non targeted workbooks

  1. #1
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Excel VBA Backup Process Backing up non targeted workbooks

    I have a backup process that backs up an important workbook when it is opened, ever 15 minutes and when closed. It works great but the problem is that when I am working in multiple workbooks once the timer hits 15 minutes..whatever file I have opened gets backed up not the file that the code is in. I have attached a file for your refernce so you can see what the process looks like. What do I need to change so that it always backs up this file and not the excel file that is currently being worked on. Hopefully that makes sense...

    If I can proivder more information please let me know..
    thanks!
    Attached Files Attached Files

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Hi there,

    Knee-jerk and untested, but you could try the following modification to your code:

    Please Login or Register  to view this content.

    Hope this helps.

    Regards,

    Greg M

  3. #3
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Thank you Greg I will try it and monitor. That is probably spot on. Much appreciate your time for reply.

  4. #4
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Greg, sorry I just noticed something Do I need to also change the following:

    Please Login or Register  to view this content.

    See right after the file path it says ActiveWorkbook.Name...Should I change it to ThisWorkbook.Name?

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Hi again,

    Good catch! I should have spotted that one

    Yes indeed, change it to ThisWorkbook - "ThisWorkbook" will always refer to the workbook which contains the code, whereas "ActiveWorkbook" refers to whichever workbook happens to be active when the code is executed.

    Regards,

    Greg M

  6. #6
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    No worries at all, I am just thankful you were able to guide me in the right directions. Much-much appreciated.
    Without this forum , my excel life would be misearable So thank you.

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Hi again,

    Many thanks for your very prompt feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

  8. #8
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Greg, I got a chance to play with this today and it still does not work unfortunately. Here is the complete code.

    Before Close
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Do you think I can change anything else?
    Last edited by wherdzik; 01-05-2023 at 01:11 PM.

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Hi again,

    Here's how I would write those routines:

    Please Login or Register  to view this content.

    Hope this helps as before, - please let me know how you get on.

    Regards,

    Greg M

  10. #10
    Forum Contributor
    Join Date
    11-19-2019
    Location
    Michigan
    MS-Off Ver
    Office 365
    Posts
    548

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Works like a dream! Thank you!

  11. #11
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,645

    Re: Excel VBA Backup Process Backing up non targeted workbooks

    Hi again,

    Many thanks for your feedback and also for the Reputation increase - much appreciated!

    You're welcome - glad I was able to help.

    Best regards,

    Greg M

+ 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. How do I merge 4 workbooks into 1 via auto backup
    By tweacle in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2022, 06:12 PM
  2. Same Process on two workbooks
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2017, 10:03 AM
  3. [SOLVED] Ensure Right Instance of Excel is targeted (from a Non-MS Product)
    By FallingDown in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2017, 11:52 AM
  4. Creating a backup of Excel Workbooks
    By BigBas in forum Excel General
    Replies: 1
    Last Post: 10-10-2007, 11:43 AM
  5. [SOLVED] Backing up Excel file
    By AccessHelp in forum Excel General
    Replies: 3
    Last Post: 01-18-2006, 08:10 PM
  6. [SOLVED] backing up Excel workbooks.
    By Primepixie in forum Excel General
    Replies: 1
    Last Post: 11-08-2005, 11:35 AM
  7. Restricting Opening Workbooks in a Previous Excel Process
    By Adam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2005, 10:06 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