Sub CreateRibbonXML_Init() 'Initalisation du XML
Dim VA, V_Idx, i As Byte, y As Byte, Idx As New Collection, Balise As New Collection
Dim myTab, myGroup, myButtonGroup, myBox, myButton
Dim B, MyB
' PS : il faut mettre tous les attributs exisants de chaque balise
' ----- ARRAY DES BALISES ------------------------------------------------------------------------------------------------------------------------------------------
'---------------------------------
myTab = Array("<tab id=" & """myTabID_", "label=""NameLabelTab""", ">")
'---------------------------------
myGroup = Array("<group id =" & """myGroupID_", "label=""NameLabelGroup""", ">")
'---------------------------------
myButtonGroup = Array("<buttonGroup id=" & """myButtonGroupID_", ">")
'---------------------------------
myBox = Array("<box id=" & """myBoxID_", "boxstyle=""vertical/horizontal""", ">")
'---------------------------------
mySplitButton = Array("<splitButton id=" & """mySplitButtonID_", ">")
'---------------------------------
myMenu = Array("<menu id=" & """myMenuID_", "itemSize=""large""", "/>")
'---------------------------------
myButtons = Array("<button id=" & """myButtonID_", "label=""NameLabelButton""", "onAction=""MacroName""", "imageMso=""NameImage""", "size=""large""", "/>")
'---------------------------------
myToggleButton = Array("<toggleButton id=" & """myToggleButtonID_", "label=""NameLabelToggleButton""", "onAction=""MacroName""", "imageMso=""NameImage""", "size=""large""", "/>")
'---------------------------------
mySeparator = Array("<separator id=" & """mySeparatorID_", "/>")
'---------------------------------
' ----- ARRAY DES BALISES ------------------------------------------------------------------------------------------------------------------------------------------
' ----- ARRAY DES BALISES TYPE COL 1 + ARRAY DE CORRESPONDANCE DE B (MyB)--------------------------------------------------------------------------------------------
'---------------------------------
B = Array("TAB", "GROUP", "BUTTONGROUP", "BOX", "SPLITBUTTON", "MENU", "BUTTON", "TOGGLEBUTTON", "SEPARATOR")
'---------------------------------
MyB = Array(myTab, myGroup, myButtonGroup, myBox, mySplitButton, myMenu, myButtons, myToggleButton, mySeparator)
'---------------------------------
' ----- ARRAY DES BALISES TYPE COL 1 + ARRAY DE CORRESPONDANCE DE B (MyB)--------------------------------------------------------------------------------------------
For i = LBound(B) To UBound(B)
Balise.Add MyB(i), B(i)
Next
VA = Sheets("XML CREATION").Cells(1).CurrentRegion.Resize(, 1).Value
ReDim V_Idx(1 To UBound(VA) - 1, 1 To 7)
ReDim Result(1 To UBound(V_Idx), 1 To 1)
On Error Resume Next
For i = 2 To UBound(VA)
Idx.Add 1, VA(i, 1)
If Err Then
Err.Clear
nb = Idx(VA(i, 1)) + 1
Idx.Remove VA(i, 1)
Idx.Add nb, VA(i, 1)
End If
V_Idx(i - 1, 1) = Idx(VA(i, 1))
For y = LBound(Balise(VA(i, 1))) To UBound(Balise(VA(i, 1)))
If y = 0 Then
V_Idx(i - 1, y + 2) = Balise(VA(i, 1))(y) & Idx(VA(i, 1)) & """"
Else
V_Idx(i - 1, y + 2) = Balise(VA(i, 1))(y)
End If
Next
Next
On Error GoTo 0
Sheets("XML CREATION").Cells(2, 2).Resize(UBound(V_Idx), UBound(V_Idx, 2)) = V_Idx
End Sub