1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| Sub AjoutButton()
ActiveSheet.Buttons.Add(650, 300, 50, 20).Select
Selection.OnAction = "Exporter"
Selection.Characters.Text = "Exporter"
With Selection.Characters(Start:=1, Length:=8).Font
.Name = "Arial"
.FontStyle = "Normal"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End Sub
Sub Exporter()
Dim year As String
Dim quarter As String
Dim Directory As String
Dim Today As String
Today = Date
Today = Replace(Today, "/", "_")
year = Range("Date!E3").Value
quarter = Range("Date!D3").Value
Directory = Range("Date!F2").Value
If Right(Directory, 1) = "\" Then
Else
Directory = Directory & "\"
End If
Select Case ActiveSheet.Name
Case "Graphique_Réorientation"
Sheets(Array("Graphique_Réorientation", "Tableau_Réorientation")).Move
ChDir Directory
ActiveWorkbook.SaveAs Filename:=Directory & "Réorientation " & quarter & year & "_" & Today, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Case "Graphique_BudgetSalleBlanche"
Sheets(Array("Graphique_BudgetSalleBlanche", "Tableau_BudgetSalleBlanche")).Move
ChDir Directory
ActiveWorkbook.SaveAs Filename:=Directory & "Budget " & quarter & year & "_" & Today, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Case "Graphique_Surnombres"
Sheets(Array("Graphique_Surnombres", "Tableau_Surnombres")).Move
ChDir Directory
ActiveWorkbook.SaveAs Filename:=Directory & "Surnombres " & quarter & year & "_" & Today, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
Case "Graphique_CoûtMoyenParAgent"
Sheets(Array("Graphique_CoûtMoyenParAgent", "Tableau_CoûtMoyenParAgent")).Move
ChDir Directory
ActiveWorkbook.SaveAs Filename:=Directory & "Coût moyen par agent " & quarter & year & "_" & Today, FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
ActiveWorkbook.Close
End Select
End Sub |
Partager