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
| Sub lecture
Const ForReading = 1, ForWriting = 2
Dim oFso, fp, fl, ExcelTele
Set oFso = CreateObject("Scripting.FileSystemObject")
'lien sur le bureau
Dim WS : Set WS = CreateObject("wscript.shell")
FloDest = WS.ExpandEnvironmentStrings("%USERPROFILE%")
Dim SurBureau : SurBureau = FloDest & "\Desktop\Resulta.xls"
'Ouvrir fichier Poste
Set fp = oFso.OpenTextFile(FichPost.Value , ForReading)
'Ouvrir fichier logiciel
Set fl = oFso.OpenTextFile(Fichlogi.Value , ForReading)
Set ExcelTele = oFso.OpenTextFile(SurBureau , ForWriting , True)
'--- Déclaration
Dim objExcel, objClasseur
Set objExcel = CreateObject("Excel.Application")
Set objClasseur = objExcel.Workbooks.Open(SurBureau)
'--- Création de la feuille si besoin
Dim strNomFeuille
strNomFeuille = "Liste logiciels tout poste"
while Not fp.AtEndOfStream
while Not fl.AtEndOfStream
Msgbox fp.ReadLine 'pour voir si ça affiche bien
Msgbox fl.ReadLine 'pour voir si ça affiche bien
objExcel.cells(1,1).value = fp.ReadLine 'nom poste
objExcel.cells(1,2).value = fl.ReadLine 'logiciel
objExcel.cells(1,3).value = fl.ReadLine 'Version
Next
Wend
Wend
objExcel.Close
fl.Close
fp.Close
End sub |
Partager