Imprimer le contenu d'une msgbox
g
Bonjour,
tout est dans le titre : je poste mon code et je souhaiterais qu'en répondant YES, cela imprime le contenu (si possible avec la même forme, enfin les même saut de ligne que le contenu de la msgbox).
Sub RESUMER()
'initialiser variable'
Dim ligne As Integer
ligne = 7
Dim DernLigne As Integer
DernLigne = Range("M1048576").End(xlUp).Row
'initialiser chaine'
Dim chaine1 As String
chaine1 = "reçu + non baed" & Chr(10)
Dim chaine2 As String
chaine2 = "reçu + baed + non bas" & Chr(10)
Dim chaine3 As String
chaine3 = "non reçu + non baed" & Chr(10)
Dim chaine4 As String
chaine4 = "reçu + baed + non bas" & Chr(10)
Dim final As String
'boucle de test'
While ligne <= DernLigne
'test par ligne'
If Not (UCase(Cells(ligne, 2).Value) Like "" Or UCase(Cells(ligne, 2).Value) Like " ") Then
'reçu + non baed)
If (UCase(Cells(ligne, 13).Value) = "TRUE" Or UCase(Cells(ligne, 13).Value) = "VRAI") And _
(UCase(Cells(ligne, 14).Value) = "FALSE" Or UCase(Cells(ligne, 14).Value) = "FAUX") Then
chaine1 = chaine1 & UCase(Cells(ligne, 3).Value) & " " & UCase(Cells(ligne, 2).Value) & Chr(10)
'reçu + baed + non bas'
ElseIf (UCase(Cells(ligne, 13).Value) = "TRUE" Or UCase(Cells(ligne, 13).Value) = "VRAI") And _
(UCase(Cells(ligne, 14).Value) = "TRUE" Or UCase(Cells(ligne, 14).Value) = "VRAI") And _
(UCase(Cells(ligne, 15).Value) = "FALSE" Or UCase(Cells(ligne, 15).Value) = "FAUX") Then
chaine2 = chaine2 & UCase(Cells(ligne, 3).Value) & " " & UCase(Cells(ligne, 2).Value) & Chr(10)
'non reçu + non baed'
ElseIf (UCase(Cells(ligne, 13).Value) = "FALSE" Or UCase(Cells(ligne, 13).Value) = "FAUX") And _
(UCase(Cells(ligne, 14).Value) = "FALSE" Or UCase(Cells(ligne, 14).Value) = "FAUX") Then
chaine3 = chaine3 & UCase(Cells(ligne, 3).Value) & " " & UCase(Cells(ligne, 2).Value) & Chr(10)
'non reçu + baed + non bas'
ElseIf (UCase(Cells(ligne, 13).Value) = "FALSE" Or UCase(Cells(ligne, 13).Value) = "FAUX") And _
(UCase(Cells(ligne, 14).Value) = "TRUE" Or UCase(Cells(ligne, 14).Value) = "VRAI") And _
(UCase(Cells(ligne, 15).Value) = "FALSE" Or UCase(Cells(ligne, 15).Value) = "FAUX") Then
chaine4 = chaine4 & UCase(Cells(ligne, 3).Value) & " " & UCase(Cells(ligne, 2).Value) & Chr(10)
End If
End If
ligne = ligne + 1
Wend
final = (chaine3 & Chr(10) & _
chaine1 & Chr(10) & _
chaine2 & Chr(10) & _
chaine4)
If MsgBox(final & Chr(10) & Chr(10) & "Voulez-vous imprimer ce résultat ?", vbYesNo) = vbYes Then
End If
'final.PrintOut'
End SubCordialement et merci d'avance.
g
Est-ce possible d'imprimer directement le conteneur d'une msgbox ou d'une variable ?