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
| Sub SetVar()
Dim C As String
Dim C1 As String
Dim C2 As String
Dim Personne As String
Dim Lamacro As String
Dim var As String
C = "C:\...\Temp"
C1 = "C:\Envoi" & " " & Format(Date, "dd") & " " & Format(Date, "mmmm") & " " & Format(Date, "yyyy")
C2 = "C:\...\Automatisation\"
Application.DisplayAlerts = False 'On désactive les boites de dialogue
Set Principal = ThisWorkbook
Set Menu = Principal.Sheets("Menu")
For i = 5 To 16
If Menu.Cells(i, 3) = "Yes" Then
Personne = Cells(i, 1)
var = Cells(i, 1) & ".xlsm" ' il existe un fichier pour chaque personne
Application.ScreenUpdating = False
Application.EnableEvents = False
Workbooks.Open Chauff2 & var
Lamacro = "Module3." & Personne
Application.Run "Lamacro"(C ,C2)
Workbooks(var).Save
Workbooks(var).Close
End If
Next
End Sub |
Partager