0% found this document useful (0 votes)
4 views2 pages

VBA Module for Certificate Analysis

The document contains a VBA module for analyzing Word files and extracting data to Excel. It checks for selected files, verifies labels, and formats the data accordingly, providing feedback on the process. Additionally, it includes a reset function to clear previous data and reset the worksheet state.

Uploaded by

Majdi Belguith
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

VBA Module for Certificate Analysis

The document contains a VBA module for analyzing Word files and extracting data to Excel. It checks for selected files, verifies labels, and formats the data accordingly, providing feedback on the process. Additionally, it includes a reset function to clear previous data and reset the worksheet state.

Uploaded by

Majdi Belguith
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Attribute VB_Name = "Module_MainWorkflow"

Option Explicit

Public Sub Analyze_Click()


Dim wsD As Worksheet: Set wsD = [Link](SHEET_DETECT)
Dim wsC As Worksheet: Set wsC = [Link](SHEET_CERT)
Dim filePath As Variant
Dim formatted As String

' Aucun fichier s�lectionn�


If gFileIndex Is Nothing Or [Link] = 0 Then
[Link]("B" & ROW_ERR1).value = "No files to analyze."
[Link]("B" & ROW_ERR2).value = "Please select Word files first."
Exit Sub
End If

' Assurer ent�tes OK


EnsureCertificatesHeader

' D�marre � la premi�re ligne libre


If gStartRow < CERT_FIRST_DATA_ROW Then gStartRow = CERT_FIRST_DATA_ROW

' Boucle fichiers s�lectionn�s


For Each filePath In [Link]

' EXTRACTION & FORMATAGE WORD


formatted = FormatCertificateWord(CStr(filePath))

' V�rification labels


If Not VerifyLabels(formatted) Then
[Link]("B" & ROW_ERR1).value = "Warning: Missing labels in file:"
[Link]("B" & ROW_ERR2).value = CStr(filePath)
' Passe au fichier suivant
Else
' EXTRACTION ? TABLEAU EXCEL
ExtractToExcel formatted
End If
Next filePath

' Message final


MsgBox "Extraction completed successfully." & vbCrLf & _
"Total certificates inserted: " & (gStartRow - CERT_FIRST_DATA_ROW), _
vbInformation, "IECEx Extraction"

End Sub
Option Explicit

Public Sub Reset_All()


Dim wsD As Worksheet: Set wsD = [Link](SHEET_DETECT)

' RESET feuille Detect


ResetDetectSheet

' RESET tableau Certificates sauf en-t�tes


ClearCertificateRows

' R�initialiser lignes de d�part


gStartRow = CERT_FIRST_DATA_ROW
gStartRowFiles = ROW_FILES_START
' Masquer ANALYZE
UI_HideAnalyze

' Nettoyage messages


[Link]("B" & ROW_ERR1 & ":B" & ROW_ERR2).ClearContents
[Link]("B" & ROW_COUNT).ClearContents

MsgBox "Reset completed successfully.", vbInformation, "RESET"


End Sub

You might also like