Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare PtrSafe Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" (ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As POINTAPI) As Long
Private Declare PtrSafe Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Type POINTAPI: X As Long: Y As Long: End Type
Private Type RECT: Left As Long: Top As Long: Right As Long: Bottom As Long: End Type
Dim mois_courant
Dim témoin, Début, Fin
Private Sub B_valid_Click()
ActiveCell.Value = CDate(Me.Date_début & " " & Me.ComboBox1)
Unload Me
End Sub
Private Sub label1_Click()
End Sub
Private Sub LbAujourdhui_Click()
End Sub
Private Sub UserForm_Activate()
Call UserformPosSurCell(Me, ActiveCell)
If DatTag > Date Then LbAujourdhui.Enabled = False 'accès bouton date aujourd'hui!?
End Sub
Private Sub ComboBox1_Change()
ActiveCell.Value = CDate(Me.Date_début & " " & Me.ComboBox1)
If ActiveCell < 10000 Then
jrs_heures.Show
ActiveCell = ""
Else
Unload Me
End If
End Sub
Private Sub Label3_Click()
End Sub
'croix inactive
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = CloseMode = 0
End Sub
Private Sub UserForm_Initialize()
Dim hdc&, TextSize As POINTAPI, Cx&, R As RECT
hdc = GetDC(FindWindow(vbNullString, Me.Caption)): GetWindowRect hwnd, R
GetTextExtentPoint32 hdc, Me.Caption, Len(Me.Caption), TextSize
Cx = (R.Right + R.Left + TextSize.X) / 2
Do While TextSize.X < Cx
Me.Caption = " " & Me.Caption
GetTextExtentPoint32 hdc, Me.Caption, Len(Me.Caption), TextSize
Loop
LbAujourdhui.Caption = Format(Date, "dddd dd mm yyyy") 'date bouton aujourd'hui
' LbNoSem1 = "": LbNoSem2 = "": LbNoSem3 = "": LbNoSem4 = "": LbNoSem5 = "": LbNoSem6 = ""
Dim décal
affiche_calendrier (Date)
mois_courant = Date
décal = Weekday(DateSerial(Year(mois_courant), Month(mois_courant), 1), vbMonday) - 1
For i = 16 To 40
Me.ComboBox1.AddItem Format(i / 48, "hh:mm")
Next i
End Sub