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
|
'dans le cas où le script est éxécuté en janvier on créé le nouveau fichier de revue de perf
set objFSO= createObject("Scripting.FileSystemObject")
modele= "C:\Documents and Settings\technicien\Bureau\Synthèse comparatives annuelle\Modele.xls"
monannee= cstr(year(date)-1)
monfichier= "C:\Documents and Settings\technicien\Bureau\Synthèse comparatives annuelle\Synthese_"&cstr(year(date))&".xls"
if month(date)=1 or month(date)=01 then
'chemins à modifier
monfichier= "C:\Documents and Settings\technicien\Bureau\Synthèse comparatives annuelle\Synthese_"&cstr(year(date))&".xls"
nouveaufichier= "C:\Documents and Settings\technicien\Bureau\Synthèse comparatives annuelle\Synthese_"&cstr(year(date))&".xls"
monannee= cstr(year(date)-1)
objFSO.CopyFile modele, nouveaufichier
end If
lemois= cstr(month(dateadd("m", -1,date)))
if len(lemois)=1 then
lemois= "0"& lemois + 7
end If
'Chemin où se trouve toutes les synthèse de chaque mois
donnees="C:\Documents and Settings\technicien\Bureau\Synthèses Mensuelles des PIC\"& monannee &"_M"& lemois &"_Synthese.xls"
If objFSO.FileExists(donnees) then
'ouverure des deux classeurs excel
Set AppExcelD = WScript.CreateObject("Excel.Application")
AppExcelD.Visible = True
AppExcelD.Workbooks.Open(donnees)
AppExcelD.Worksheets("TDB mensuel").activate
Set AppExcelF = WScript.CreateObject("Excel.Application")
AppExcelF.Visible = True
AppExcelF.Workbooks.Open(monfichier)
AppExcelF.Worksheets("Donnees").activate
laligne= 1
if month(date)>1 then
laligne= 1+ (14* (month(date)-2))
end If
'Objets injectés
'Angers
Monrang = AppExcelD.Range("C92:H120")
maPlage= ("C" & lemois+4)
AppExcelD.WorksheetFunction.VLookup("Objets injectés" , ("C92:H120"), 3, False).select
AppExcelD.WorksheetFunction.VLookup("Objets injectés" , ("C92:H120"), 3, False).Copy
AppExcelF.Range(maPlage).Select
AppExcelF.ActiveSheet.paste
AppExcelD.CutCopyMode = False |
Partager