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
| Sub Workbook_Open()
Dim Wb_Source As Workbook, Wb_Dest As Workbook
Dim i As Integer
Dim fso As Object, Src$, Dest$, Fich$
Dim Rep_source As String, Rep_dest As String, Rep_dest2 As String
Dim Date_Jour As String, Date_Jour1 As String, Date_Jour2 As String, Date_Jour3 As String
Dim j1 As Byte, j2 As Byte
If Weekday(Now) = 2 Then 'lundi
j1 = 3
j2 = 4
End If
If Weekday(Now) = 3 Then 'mardi
j1 = 1
j2 = 4
End If
If Weekday(Now) = 4 Or Weekday(Now) = 5 Or Weekday(Now) = 6 Then 'mercredi, jeudi, vendredi
j1 = 1
j2 = 2
End If
Date_Jour = Format(Now, "yyyy_mm_dd")
Date_Jour1 = Format(Now - j1, "yyyy_mm_dd")
Date_Jour3 = Format(Now, "yyyymmdd")
Rep_source = "C:\murex_ftp\reports\itd\fo_citi\" & Date_Jour3 & "\"
Rep_dest = "M:\01_Murex\Citi\"
ArrWd = Split(("efsf_frontoffice_extract"), ";")
ArrWd2 = Split(("Source"), ";")
Set Wb_Dest = Workbooks.Open(Rep_dest & "Extended_ MurexCitiFileExtractwith adjusted time_JPA new macro.xlsm") 'ouvre le classeur destination
For i = 0 To UBound(ArrWd)
Set Wb_Source = Workbooks.Open(Rep_source & ArrWd(i) & "_" & Date_Jour3 & ".csv", , True) 'ouverture en lecture seule du classeur source
Wb_Source.Sheets(1).Cells.Copy Wb_Dest.Sheets(ArrWd2(i)).Range("a1") 'copier/coller
Wb_Source.Close False 'ferme le classeur source
Next i
Wb_Dest.Close True 'ferme le classeur destination avec enregistrement
End Sub |
Partager