Backup a xlam workbook

  • Had this posted on another site, no responses
    http://www.mrexcel.com/forum/e…2-save-xlam-workbook.html


    I have a add-in file that run in back ground,I want to put a command button on userform to save current xlam to a folder on C:\Backup. I run the xlam from a thumb drive on different
    computers during the day,when I get home I would like to backup this data. I know I can copy the file and paster in folder but wonder if I can do this with commandbutton??


    Thanks Z

  • Re: Backup a xlam workbook


    Hi Z


    Try this


    Code
    Sub macro1()
        Workbooks("enter wb name here.xlam").IsAddin = False
        'your code here
        Workbooks("enter wb name here.xlam").IsAddin = True
    End Sub
  • Re: Backup a xlam workbook


    Getting closer, the backup goes to C: , it should go to C:\Backup


  • Re: Backup a xlam workbook


    I won't be able to help until late tonight. However it looks like you are getting there. When you are done try removing the two lines of code I gave you as it may well work without them. But you would have to change thisworkbook to the add in file name.

  • Re: Backup a xlam workbook


    Not sure why but it working ok now. The only problem I have is if I try and use the file it won't work. said File Extension is not valid?. ext. is xlam and name is correct?

  • Re: Backup a xlam workbook


    Thanks holycow
    I did remove the two lines and its working perfect.


    Is it possible to add to the code a way to create the directory if not there? So after its created it won't have to again, maybe some kind of IF statement?

  • Re: Backup a xlam workbook


    Roy
    The question was if directory does not exist can the code create one. I did not ask for your opinion on what makes sense. What does not make sense to you makes
    sense to me.If you did not want to answer the question don't respond. Not every body is as smart as you,I think this is a Help forum,the reason for the backup is in case thumb drive in stolen or damaged.
    One think I learned in life was if nobody ask me for a opinion I kept it to myself.

  • Re: Backup a xlam workbook


    zplugger,


    Roy was actually asking a perfectly legitimate question and only trying to help.


    By posting a question on a free help forum - asking for help, you have indeed asked for other people's opinions. I suggest in future you show more respect and be grateful to those offering you free assistance... or find another forum that suit's your poor attitude.


    PM me when you have made up your mind and I will unlock your thread.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!