renommer commandbutton activex
Bonjour,
J'aimerais renommer un contrôle activex "Commandbutton" via cette macro :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub RenommerBoutons()
Dim usf As Object
Dim ctl As Object
Dim i As Byte
Dim j As Byte
Set usf = ThisWorkbook.VBProject.VBComponents("Feuil2")
For Each ctl In usf.Designer.Controls
If TypeName(ctl) = "CommandButton" Then
i = i + 1
ctl.Name = "Toto" & i
End If
Next
For Each ctl In usf.Designer.Controls
If TypeName(ctl) = "CommandButton" Then
j = j + 1
ctl.Caption = "Toto" & j
End If
Next
End Sub |
Mais cela bugue à cet endroit :
Code:
Set usf = ThisWorkbook.VBProject.VBComponents("Feuil2")
en me mettant : "L'accès par programme au projet Visual Basic n'est pas viable"... Quelqu'un pourrait-il m'aider ?
Merci d'avance,
lbroc84