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 65 66 67 68 69 70 71 72 73 74 75 76 77
| Public Sub scan(dossier As Folder)
Dim ssdossier As Folder
For Each fichier In dossier.Files
Call impression
Next
For Each ssdossier In dossier.SubFolders
scan ssdossier
Next
End Sub
Public Sub impression() '(fichier As File)
Dim adresse As String
Dim sauv As String
Dim com1, com2, com3
adresse = CStr(fichier) 'conversion du chemin du fichier en chaine de caracteres
com1 = ExtraitElement(adresse, 9, "\") 'on recupere le n° de semaine
com2 = ExtraitElement(adresse, 10, "\") 'le n° de machine
com3 = ExtraitElement(adresse, 11, "\") 'le code pneu
Dim valeur1, valeur2, valeur3, valeur4, valeur5, valeur6
Dim oExcel As excel.Application
Dim wrkBook As excel.Workbook
Dim machin
Dim truc
nombre = 0
'************************************************************************
'* Ouvrir un classeur
'************************************************************************
On Error Resume Next
Set oExcel = New excel.Application
Set wrkBook = oExcel.Application.Workbooks.Open("U:\TEMP\recuperation\calcul spc sous excel2.xls")
'Ouvrir le classeur provisoire.xls
oExcel.Application.Sheets(1).Select 'revenir a la 1 posit
oExcel.Application.Worksheets.Add 'Ajouter 1 n feuille
oExcel.Application.Range("A1").Select ' Idem
oExcel.Sheets(1).Name = "SPC"
oExcel.Visible = True
Dim ligne As String
Dim LigneExcel, colonneexcel As Integer
Dim PointVirgule1 As Integer
Dim Data1 As String
'Ouvrir le fichier texte "txt" en mode lecture
Open adresse For Input As #1
'Rendre visible EXCEL
'Appli.Visible = True
'Créer un nouveau classeur EXCEL initialisé à la ligne 1
'Appli.Workbooks.Add.Activate
LigneExcel = 1
colonneexcel = 1
'Inscrire le contenu du fichier texte dans la feuille 1 du classeur EXCEL
Do While EOF(1) = False
'ici, remplisage des feuilles, je passe les détails
oExcel.DisplayAlerts = False
oExcel.Worksheets("SPC").Delete
oExcel.DisplayAlerts = True
oExcel.Worksheets("exterieur").Select
ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, ActivePrinter:="QA_RICOH_PC sur Froff01", Collate:=True
'oExcel.Worksheets("interieur").Select
'ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, ActivePrinter:="QA_RICOH_PC sur Froff01", Collate:=True
Clipboard.Clear ' vider le buffer d'application
If oExcel.Workbooks.Count > 0 Then ' Fermer les
oExcel.ActiveWorkbook.Close False 'classeur
oExcel.Quit
End If
Set wrkBook = Nothing ' A ne pas oublier
Set oExcel = Nothing
azerty = "U:\TEMP\sauvegarde" + "\" + FRT
MkDir (azerty)
azertyu = azerty + "\" + com2
MkDir (azertyu)
FileCopy (fichier), (azertyu + "\" + com3)
End Sub |
Partager