Attribute VB_Name = "Module_VerifyLabels"
Option Explicit
' ======= ETAPE 3 : VERIFICATION DES LIBELL�S =======
Public Sub VerifyLabels_Step3()
gCurrentStep = 3
Dim i As Long, wdDoc As Object, text As String, normalized As String
Dim dummyCount As Long
If IsEmpty(gFormattedFiles) Then
UI_SetNote "No formatted files found.", "STEP 3 - Aborted"
Exit Sub
End If
On Error GoTo Handler
For i = LBound(gFormattedFiles) To UBound(gFormattedFiles)
' Ouvrir le document
Set wdDoc = [Link](gFormattedFiles(i))
' Lire le texte
text = [Link]
' Normaliser le texte (labels)
normalized = BuildNormalizedText(text, dummyCount)
' R��crire le contenu
[Link]
[Link] normalized
' Sauvegarder et fermer
[Link]
[Link] False
' Feedback progression
UI_SetNote "Verifying labels: " & i & " / " & UBound(gFormattedFiles),
"STEP 3 - In progress"
DoEvents
Next i
' Message final
UI_SetNote "Label verification completed for all formatted files.", "STEP 3 -
Done"
UI_ShowNext True
Exit Sub
Handler:
MsgBox "Error during label verification: " & [Link], vbExclamation
End Sub
' ======= Fonction de normalisation =======
Private Function BuildNormalizedText(ByVal srcText As String, ByRef countLabels As
Long) As String
' Exemple simple : supprimer espaces multiples et uniformiser les libell�s
Dim cleaned As String
cleaned = Replace(srcText, vbCrLf, vbLf)
cleaned = Replace(cleaned, vbCr, vbLf)
cleaned = Trim(cleaned)
' TODO : Ajouter logique pour v�rifier et corriger les libell�s
countLabels = 0 ' Placeholder
BuildNormalizedText = cleaned
End Function