==Bonjour==
Page 1 sur 1
==Bonjour==
Cette macro est a mettre dans VBAproject/ThisWorkbook, comme ca cette macro demarre des que le classeur s'ouvre.
Private Sub Workbook_Open()
Dim Msg As String
If Time < 0.5 Then
Msg = " jour!"
ElseIf Time >= 0.5 And Time < 0.75 Then
Msg = " apres-midi!"
Else
Msg = " soir!"
End If
MsgBox "Bon" & Msg
Msg1 = "Nous sommes "
Msg2 = ", et il est "
Msg3 = " le "
If Weekday(Now) = 1 Then MsgBox Msg1 & "Dimanche" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 2 Then MsgBox Msg1 & "Lundi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 3 Then MsgBox Msg1 & "Mardi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 4 Then MsgBox Msg1 & "Mercredi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 5 Then MsgBox Msg1 & "Jeudi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 6 Then MsgBox Msg1 & "Vendredi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 7 Then MsgBox Msg1 & "Samedi" & Msg3 & Date & Msg2 & Time
End Sub
Private Sub Workbook_Open()
Dim Msg As String
If Time < 0.5 Then
Msg = " jour!"
ElseIf Time >= 0.5 And Time < 0.75 Then
Msg = " apres-midi!"
Else
Msg = " soir!"
End If
MsgBox "Bon" & Msg
Msg1 = "Nous sommes "
Msg2 = ", et il est "
Msg3 = " le "
If Weekday(Now) = 1 Then MsgBox Msg1 & "Dimanche" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 2 Then MsgBox Msg1 & "Lundi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 3 Then MsgBox Msg1 & "Mardi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 4 Then MsgBox Msg1 & "Mercredi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 5 Then MsgBox Msg1 & "Jeudi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 6 Then MsgBox Msg1 & "Vendredi" & Msg3 & Date & Msg2 & Time
If Weekday(Now) = 7 Then MsgBox Msg1 & "Samedi" & Msg3 & Date & Msg2 & Time
End Sub
Page 1 sur 1
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|