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 78 79 80 81 82 83 84 85
| '*****************************************************************************************
' Generation/Traduction des fichiers
'*****************************************************************************************
Private Sub ButGenerate_Click()
Dim LigneIn As String
Dim LigneExcel As Integer
Dim compt As Integer
Dim litDico As Integer
Dim litOut As Integer
Dim intReturnValue As Integer
Dim strRead As String
Dim strReplace As String
'activer la feuille "Memory" à la ligne 1 -----------------------------------
'Sheets("Memory").Activate
LigneExcel = 2
'Inscrire le contenu d'une feuille Excel dans une autre
LigneIn = Sheets("Work files").Cells(LigneExcel, 3)
If LigneIn = "" Then
MsgBox " Not Data transfered, the entry list is empty ! ", vbCritical, "Caution"
Else
For LigneExcel = 2 To 10000
Sheets("Result").Cells(LigneExcel, 1) = Sheets("Work files").Cells(LigneExcel, 3)
Sheets("Result").Cells(LigneExcel, 2) = CStr(";")
Sheets("Result").Cells(LigneExcel, 3) = LigneIn
'Cherche et remplace une chaine de caractère ---------------------------------
litOut = 2
litDico = 2
litOut = litOut + 1
For litDico = 2 To 10000
intReturnValue = InStr(1, Sheets("Result").Cells(litOut, 3), Sheets("Memory").Cells(litDico, 1), 1)
strRead = Sheets("Result").Cells(litOut, 3)
strReplace = Sheets("Memory").Cells(litDico, 3)
If intReturnValue = 0 Then
Else
Mid(strRead, intReturnValue, Len(Sheets("Memory").Cells(litDico, 1))) = strReplace
Sheets("Result").Cells(litOut, 3) = strReplace
End If
Next litDico
Exit Sub
LigneExcel = LigneExcel + 1
'GoTo suite
Next LigneExcel
End If
'Return information success -----------------------------------------------------------------------------
MsgBox "All files has been processed.", vbExclamation, "Congratulation!"
End Sub
Private Sub ButBrowse_Click()
'Récupération du chemin de travail
strPathJob = SelectFolder("Sélectionnez un répertoire :", 0)
If strPathJob <> "" Then
' Permet de modifier la valeur Text du champ de texte.
TxtJobDirectory.Text = strPathJob 'indique le chemin complet
TxtJobDirectory.BackColor = &H80000005 'change la couleur du label
ButBrowse.Visible = True
ListFilesInFolder strPathJob, True
Sheets("Memory").Cells(2, 4) = TxtJobDirectory
Else
MsgBox "Please select a job directory only which contain all CATIA files!", vbCritical, "!STOP!"
End If
Exit Sub
End Sub |