PDA

View Full Version : CommandButton - Save in multiple locations



otdrmn
03-16-2016, 05:46 PM
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

GTO
03-16-2016, 11:57 PM
Have you tried: ThisWorkbook.SaveCopyAs FileName

Mark