Seamus2626
asked on
Message box - overwrite file
Hi,
My below sub saves a file
If the file is already there I want a Yes/No message box saying "File already exist, overwrite"
If yes, overwrite, if no exit sub
Thanks
Sub SaveTheFile_BB()
'This code saves the file that has been manipulated with the affix "Manipulated"
'This means, for audit and cross checking purposes, we have the original file and the
'manipulated file
SuffixDate = Format(Date, "dd mmm")
FileYear = Year(Date)
MonthOffset = 0
If Day(Date) = 1 Then MonthOffset = 1
FileMonth = Month(Date) - MonthOffset
FileDate = Format(Date, "mmm yy")
FilePath = "R:\SPM\CAO\FRA\" & FileYear & "\" & FileDate & "\France BB - " & SuffixDate & ".xlsx"
ActiveWorkbook.SaveAs Filename:=FilePath
ActiveWorkbook.Close
End Sub
My below sub saves a file
If the file is already there I want a Yes/No message box saying "File already exist, overwrite"
If yes, overwrite, if no exit sub
Thanks
Sub SaveTheFile_BB()
'This code saves the file that has been manipulated with the affix "Manipulated"
'This means, for audit and cross checking purposes, we have the original file and the
'manipulated file
SuffixDate = Format(Date, "dd mmm")
FileYear = Year(Date)
MonthOffset = 0
If Day(Date) = 1 Then MonthOffset = 1
FileMonth = Month(Date) - MonthOffset
FileDate = Format(Date, "mmm yy")
FilePath = "R:\SPM\CAO\FRA\" & FileYear & "\" & FileDate & "\France BB - " & SuffixDate & ".xlsx"
ActiveWorkbook.SaveAs Filename:=FilePath
ActiveWorkbook.Close
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.