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 init_bar02()
Dim sm As Variant, cel As Range, Pict As IPictureDisp
On Error Resume Next
CommandBars("bar02").Delete
On Error GoTo 0
Set bar_02 = Application.CommandBars.Add("bar02", msoBarPopup)
Set sm = bar_02.Controls.Add(msoControlButton, 1, , , True)
With sm
.Caption = "Pas d'image"
.Tag = ""
.OnAction = "bar_02_go"
End With
For Each cel In Range("villes")
Set Pict = stdole.StdFunctions.LoadPicture(cel.Offset(0, 1))
Set sm = bar_02.Controls.Add(msoControlButton, , , , True)
With sm
.Picture = Pict
.Caption = cel.Value
.Tag = cel.Value
.OnAction = "bar_02_go"
.Style = msoButtonIconAndCaption
End With
Next
End Sub |
Partager