Option Explicit
' -----------------ARGUMENT RUBBERDUCK-----------------------------
'@ModuleDescription "Initialisation des tableaux structurés."
'@IgnoreModule
'@Folder "System"
' -----------------DESCRIPTION-------------------------------------
' Module : [Factory]
' Description : Initialisation des tabeaux stucturés.
' Auteur : Jean-Paul Grumel (Valtrase)
' Date de Création : 14/04/2023
' Dernière Modification : 27/01/2026
' Version : 1.2
' -----------------------------------------------------------------
' Clause de Redistribution et d'Utilisation
' Redistribution and Usage Clause
' -----------------------------------------------------------------
'
' Ce code est fourni **à titre d'exemple** et est destiné à des fins
' éducatives ou d'illustration uniquement.
' This code is provided **as an example** and is intended for
' educational or illustrative purposes only.
'
' **Redistribution :**
' Vous avez la permission de redistribuer, modifier et utiliser ce code
' dans vos projets.
' You have permission to redistribute, modify, and use this code
' in your projects.
'
' **Attribution :**
' Toute redistribution ou utilisation substantielle de ce code doit
' impérativement **citer l'auteur original Jean-Paul Grumel (Valtrase)**.
' Any substantial redistribution or use of this code must
' absolutely **cite the original author Jean-Paul Grumel (Valtrase)**.
'
' **Clause de Non-Responsabilité :**
' **Disclaimer :**
'
' Ce code est fourni "tel quel", sans garantie d'aucune sorte, expresse
' ou implicite, y compris, mais sans s'y limiter, les garanties de
' qualité marchande, d'adéquation à un usage particulier et de non-
' contrefaçon. L'auteur ne sera en aucun cas responsable de tout
' dommage direct, indirect, spécial, accessoire ou consécutif découlant
' de l'utilisation ou de l'incapacité d'utiliser le code.
' This code is provided "as is", without warranty of any kind, express
' or implied, including but not limited to the warranties of
' merchantability, fitness for a particular purpose and non-
' infringement. In no event shall the author be liable for any
' direct, indirect, special, incidental, or consequential damages
' arising from the use or inability to use the code.
'
' -----------------------------------------------------------------
'@Description "Retourne un objet ListObject s'il existe sinon retourne Nothing"
Private Function getListObject( _
ByVal ListName As String, _
Optional ByVal Workbook As Excel.Workbook _
) As Excel.ListObject
Dim localWorkbook As Excel.Workbook
Set localWorkbook = Workbook
If localWorkbook Is Nothing Then Set localWorkbook = ThisWorkbook
With localWorkbook
Do
Dim CounterSheets As Integer
CounterSheets = CounterSheets + 1
Dim CounterListObjects As Integer: CounterListObjects = 0
With .Worksheets(CounterSheets)
Do While CounterListObjects < .ListObjects.Count And getListObject Is Nothing
CounterListObjects = CounterListObjects + 1
If StrComp(ListName, .ListObjects(CounterListObjects).Name, vbTextCompare) = 0 Then Set getListObject = .ListObjects(CounterListObjects)
Loop
End With
Loop While CounterSheets < .Worksheets.Count And getListObject Is Nothing
End With
End Function
''@Description "Initialise le tableau des paramètres."
'Public Function InitTabSettings( _
' Optional ByVal Reset As Boolean _
' ) As ListObject
'
' Static item As ListObject
' If item Is Nothing Or Reset Then
' Set item = getListObject("vt_Settings")
' End If
' Set InitTabSettings = item
'End Function
'@Description "Initialise le tableau des données de base."
Public Function InitTabData( _
Optional ByVal Reset As Boolean _
) As ListObject
Static item As ListObject
If item Is Nothing Or Reset Then
Set item = getListObject("vt_Clients")
End If
Set InitTabData = item
End Function