JNP
XLDnaute Barbatruc
Bonjour 🙂,
Je souhaiterais mettre à jour une ComboBox en temps réel. Je souhaite enrichir la liste à chaque fois que je met une nouvelle entrée. Pour cela, j'ai codé mon xml ainsi :
	
	
	
	
	
		
Puis j'ai utilisé les macros suivantes :
	
	
	
	
	
		
	
	
	
	
	
		
	
	
	
	
	
		
avec une liste dans la première colonne de la feuille Base.
Les Items supplémentaires sont bien rajoutés, mais quand je retourne dans le ComboBox, celui-ci n'a pas évolué 😱
Quelqu'un aurait-il une idée ?
Merci d'avance 😎
	
		
			
		
		
	
				
			Je souhaiterais mettre à jour une ComboBox en temps réel. Je souhaite enrichir la liste à chaque fois que je met une nouvelle entrée. Pour cela, j'ai codé mon xml ainsi :
		Code:
	
	
	[SIZE=2][COLOR=#0000ff]<[/COLOR][/SIZE][SIZE=2][COLOR=#800000]comboBox [/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]id[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff]Combo1[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#ff0000]label[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff]Choix : [/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#ff0000]getItemCount[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff]NombreItemComboBox[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#ff0000]getItemLabel[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff]ComboLabel[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#ff0000]onChange[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]=[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff]ChangeCombo1[/COLOR][/SIZE][SIZE=2]"[/SIZE][SIZE=2][COLOR=#0000ff] /> [/COLOR][/SIZE]
	
		Code:
	
	
	Sub NombreItemComboBox(control As IRibbonControl, ByRef returnedVal)
If control.ID = "Combo1" Then returnedVal = Base.Range("a65500").End(xlUp).Row
End Sub
	
		Code:
	
	
	'Callback for Combo1 getItemLabel
Sub ComboLabel(control As IRibbonControl, index As Integer, ByRef returnedVal)
If control.ID = "Combo1" Then returnedVal = Base.Cells(index + 1, 1)
End Sub
	
		Code:
	
	
	'Callback for Combo1 onChange
Sub ChangeCombo1(control As IRibbonControl, text As String)
Dim I As Integer, Nouveau As Boolean
Nouveau = True
If control.ID = "Combo1" Then
    For I = 1 To Base.Range("a65500").End(xlUp).Row
        If text = Base.Cells(I, 1) Then Nouveau = False
    Next I
    If Nouveau = True Then
        Base.Cells(Base.Range("a65500").End(xlUp).Row + 1, 1) = text
    End If
End If
End Sub
	Les Items supplémentaires sont bien rajoutés, mais quand je retourne dans le ComboBox, celui-ci n'a pas évolué 😱
Quelqu'un aurait-il une idée ?
Merci d'avance 😎