Sub Accepted()

'Save file?
Msg = "Do you want to save your Quotation file ?"
Style = vbYesNo + vbQuestion + vbDefaultButton1
Title = "Devis accepté"
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
ActiveWorkbook.Close
End If
If Response = vbYes Then
ActiveWorkbook.Save
End If

'Filename
Dim Chemin As String
projet = Sheets("Hypo").Range("c5").Value
date_last_save = Sheets("Hypo").Range("c7").Value
d = Day(date_last_save)
m = Month(date_last_save)
y = Year(date_last_save)

Sheets("Control").Visible = True
Sheets("Cover page CAA").Visible = True
Sheets("Hypo").Visible = True
Sheets("Transfer datas").Visible = True
Sheets("Stability-FUS #1").Visible = True
Sheets("Stability-FUS #2").Visible = True
Sheets("Stability-FUS #3").Visible = True
Sheets("D o C Batch").Visible = True
Sheets("Invest detail").Visible = True


fname = projet & "- accepted - " & d & "-" & m & "-" & y

   
open_book = ActiveWorkbook.Name
Set newbook = Workbooks.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
Sheets.Add
new_book_name = ActiveWorkbook.Name

Workbooks(open_book).Activate
Sheets("Control").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 75
ActiveSheet.Name = "Control"
ActiveSheet.Tab.ColorIndex = 35

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
    
Workbooks(open_book).Activate
Sheets("Cover page CAA").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(2).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 55
ActiveSheet.Name = "Cover page CAA"
ActiveSheet.Tab.ColorIndex = 36

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With

Workbooks(open_book).Activate
Sheets("Hypo").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(3).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 60
ActiveSheet.Name = "Hypo"
ActiveSheet.Tab.ColorIndex = 36

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With


Workbooks(open_book).Activate
Sheets("Transfer datas").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(4).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 70
ActiveSheet.Name = "Transfer datas"
ActiveSheet.Tab.ColorIndex = 37

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With

Workbooks(open_book).Activate
Sheets("Stability-FUS #1").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(5).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 85
ActiveSheet.Name = "Stability-FUS #1"
ActiveSheet.Tab.ColorIndex = 35

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With


Workbooks(open_book).Activate
Sheets("Stability-FUS #2").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(6).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 85
ActiveSheet.Name = "Stability-FUS #2"
ActiveSheet.Tab.ColorIndex = 35

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
    
Workbooks(open_book).Activate
Sheets("Stability-FUS #3").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(7).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 85
ActiveSheet.Name = "Stability-FUS #3"
ActiveSheet.Tab.ColorIndex = 35

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With

    
Workbooks(open_book).Activate
Sheets("D o C Batch").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(8).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 100
ActiveSheet.Name = "D o C Batch"
ActiveSheet.Tab.ColorIndex = 3

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With

Workbooks(open_book).Activate
Sheets("Invest detail").Select
Cells.Select
Selection.Copy
Range("A1").Select
Workbooks(new_book_name).Activate
Sheets(9).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.Zoom = 70
ActiveSheet.Name = "Invest detail"
ActiveSheet.Tab.ColorIndex = 34

'format
ActiveSheet.PageSetup.PrintArea = ""
    With ActiveSheet.PageSetup
        .LeftFooter = "&Z&F"
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.393700787401575)
        .BottomMargin = Application.InchesToPoints(0.393700787401575)
        .FooterMargin = Application.InchesToPoints(0.196850393700787)
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With

Msg = "Le devis est enregistré dans V:\Storage\Cenexi Services\Business\Devis Acceptés New Quotation\ "
Style = vbOKOnly + vbDefaultButton1
Title = "Devis accepté"
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then
End If

'save as
Chemin = "V:\Storage\Cenexi Services\Business\Devis Acceptés New Quotation\"
    ActiveWorkbook.SaveAs Filename:=Chemin & projet & "_accepted_" & d & "-" & m & "-" & y
If filesavename <> False Then
End If


Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True


End Sub