Consulting

Results 1 to 2 of 2

Thread: CommandButton - Save in multiple locations

  1. #1
    VBAX Newbie
    Joined
    Mar 2016
    Posts
    1
    Location

    CommandButton - Save in multiple locations

    Hi guys, first time poster and new to VBA

    I have an excel spreadsheet that has a command button that Saves the file to a specific location on the hard drive using information from the spreadsheet and a date/ time stamp (as below)
    This works well, HOWEVER, I need the file to also save a copy in the C drive as it links with a dropbox account

    For the life of me I cant seem to workout how to do this, please help this novice.

    Thanks n advance

    G

    Code:
    Private Sub CommandButton1_Click()
    Dim Path As String
    Dim FileName1 As String
    Dim dt As String
    Path = "D:\JobFiles\"
    FileName1 = Range("F2")
    dt = Format(CStr(Now), "yyyy_mm_dd_hh_mm")
    ActiveSheet.SaveAs FileName:=Path & FileName1 & "-" & dt & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
    End Sub

  2. #2
    Knowledge Base Approver VBAX Guru GTO's Avatar
    Joined
    Sep 2008
    Posts
    3,368
    Location
    Have you tried: ThisWorkbook.SaveCopyAs FileName

    Mark

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •