OVH Cloud OVH Cloud

une seule boite message

2 réponses
Avatar
Daniel
Bonjour à tous

Dans cette macro je voudrait avoir le choix dans une seule boite message,
et a la place de oui, avoir le mot Modifier
et a la place de non, avoir le mot Quitter.
Merci

Sub anniversaire()
Set feuil = ThisWorkbook.Sheets(1)
demi = feuil.Range("durée") / 2
For lin = 1 To feuil.Cells.SpecialCells(xlCellTypeLastCell).Row
Set cel = feuil.Cells(lin, 1)
If IsDate(cel) Then
If Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now))) < demi _
Or Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now) + 1)) < demi Then
blabla = blabla & Chr(13) & Chr(13) & Format(feuil.Cells(lin, 1), " dd
mmm") & " = " & feuil.Cells(lin, 2) & " " & feuil.Cells(lin, 3) & " " &
feuil.Cells(lin, 5) & " " & feuil.Cells(lin, 6)
End If
End If
Next
If blabla <> "" Then MsgBox "Anniversaire de " & (blabla)
If ThisWorkbook.Name = "anniversaires.xla" Then ThisWorkbook.Close (False)
If MsgBox("Désirez-vous continuer ...?", vbCritical _
+ vbYesNo, "Attention") = vbNo Then
ThisWorkbook.Close True
End If

End Sub

2 réponses

Avatar
anonymousA
bonjour,

c'est toujours possible de modifier les boites de messages. Pour celà alller
sur le site de Ivan Moala. tu y trouveras matière.
Ceci dit, une gestion des réponses par un formulaire serait peut-être plus
simple, tu ne crois pas ?

A+


Bonjour à tous

Dans cette macro je voudrait avoir le choix dans une seule boite message,
et a la place de oui, avoir le mot Modifier
et a la place de non, avoir le mot Quitter.
Merci

Sub anniversaire()
Set feuil = ThisWorkbook.Sheets(1)
demi = feuil.Range("durée") / 2
For lin = 1 To feuil.Cells.SpecialCells(xlCellTypeLastCell).Row
Set cel = feuil.Cells(lin, 1)
If IsDate(cel) Then
If Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now))) < demi _
Or Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now) + 1)) < demi Then
blabla = blabla & Chr(13) & Chr(13) & Format(feuil.Cells(lin, 1), " dd
mmm") & " = " & feuil.Cells(lin, 2) & " " & feuil.Cells(lin, 3) & " " &
feuil.Cells(lin, 5) & " " & feuil.Cells(lin, 6)
End If
End If
Next
If blabla <> "" Then MsgBox "Anniversaire de " & (blabla)
If ThisWorkbook.Name = "anniversaires.xla" Then ThisWorkbook.Close (False)
If MsgBox("Désirez-vous continuer ...?", vbCritical _
+ vbYesNo, "Attention") = vbNo Then
ThisWorkbook.Close True
End If

End Sub






Avatar
Jacky
Bonsoir,

Un petit coup de F1 sur Msgbox pour avoir les possibilités des constantes
de Msgbox
Sinon, point de solution, il faudra un UserForm

Salutations
JJ

"Daniel" a écrit dans le message de
news:tpY%d.83719$
Bonjour à tous

Dans cette macro je voudrait avoir le choix dans une seule boite
message,

et a la place de oui, avoir le mot Modifier
et a la place de non, avoir le mot Quitter.
Merci

Sub anniversaire()
Set feuil = ThisWorkbook.Sheets(1)
demi = feuil.Range("durée") / 2
For lin = 1 To feuil.Cells.SpecialCells(xlCellTypeLastCell).Row
Set cel = feuil.Cells(lin, 1)
If IsDate(cel) Then
If Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now))) < demi _
Or Abs(Now - 1 + demi - DateValue(Day(cel) & " " & Month(cel) & " " &
Year(Now) + 1)) < demi Then
blabla = blabla & Chr(13) & Chr(13) & Format(feuil.Cells(lin, 1), " dd
mmm") & " = " & feuil.Cells(lin, 2) & " " & feuil.Cells(lin, 3) & "
" &

feuil.Cells(lin, 5) & " " & feuil.Cells(lin, 6)
End If
End If
Next
If blabla <> "" Then MsgBox "Anniversaire de " & (blabla)
If ThisWorkbook.Name = "anniversaires.xla" Then ThisWorkbook.Close
(False)

If MsgBox("Désirez-vous continuer ...?", vbCritical _
+ vbYesNo, "Attention") = vbNo Then
ThisWorkbook.Close True
End If

End Sub