+ Reply to Thread
Results 1 to 4 of 4

Save to two different locations

Hybrid View

  1. #1
    Registered User
    Join Date
    09-04-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    23

    Save to two different locations

    Hi all,


    I want my workbook to save to two different specified locations. After pressing the button it will copy the values of the table to another table.
    And after i wanted this to copy the active workbook to another location.

    Meaning that it would open the Antonio Tasks.xls and replace the table and save. And after create a coy of Antonio Tasks.xls in another location ( like a backup )

    Is this possible ?

    PS: I'm using the code below and have tried to implement it but can only save once.




    Private Sub CommandButton1_Click()
        Sheets("Home").Select
    End Sub
    
    Private Sub CommandButton2_Click()
        Workbooks.Open ("Z:\1. Ennis\7. Antonio Tasks\Antonio Tasks.xls")
        Application.GoTo Reference:="Tabela1143"
        Selection.ClearContents
        Windows("Ennis V1.xlsm").Activate
        Range("Tabela237").Select
        Selection.Copy
        Windows("Antonio Tasks.xls").Activate
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=False
        Application.CutCopyMode = False
        ActiveWorkbook.Save
        ActiveWindow.Close
    End Sub

    Thanks for all the help !!!
    Last edited by phoztek; 02-21-2011 at 01:31 PM.

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

    Re: Save to two different locations

    Hi there,

    In view of the fact that you're closing the workbook immediately after you've saved it, a simple way to create a second copy of the workbook is to add the following line of code between your ".Save" and ".Close" statements:

    ActiveWorkbook.SaveAs Filename:="MyBackupFolder" & "\" & ActiveWorkbook.Name


    Hope this works - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    09-04-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Save to two different locations

    Quote Originally Posted by Greg M View Post
    Hi there,

    In view of the fact that you're closing the workbook immediately after you've saved it, a simple way to create a second copy of the workbook is to add the following line of code between your ".Save" and ".Close" statements:

    ActiveWorkbook.SaveAs Filename:="MyBackupFolder" & "\" & ActiveWorkbook.Name


    Hope this works - please let me know how you get on.

    Regards,

    Greg M


    Thanks Greg, it worked like a charm.

    Cheers

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

    Re: Save to two different locations

    Hi again,

    Many thanks for your feedback - glad I was able to help.

    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)

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