1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
Dim Cbar As CommandBar, Ctxt As CommandBarComboBox
Sub Creation_MaBarre()
Set Cbar = CommandBars.Add(Name:="MaBarre", Position:=msoBarTop, Temporary:=True)
Set Ctxt = Cbar.Controls.Add(msoControlEdit)
With Ctxt
.Style = msoComboLabel
.Caption = "Heure :"
End With
Cbar.Visible = True
SetTimer Application.hWnd, 0, 1000, AddressOf UpDateTime
End Sub
Sub UpDateTime(ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long)
Ctxt.Text = Format(Time, "HH:MM:SS")
End Sub
Sub Sup_MaBarre()
KillTimer Application.hWnd, 0
CommandBars("MaBarre").Delete
End Sub |
Partager