1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| Private Sub Command51_Click()
On Error GoTo Err_Command51_Click
Dim stDocName As String
Dim texte As String
Dim mission As String
Dim Chef_mission As String
Dim collectif As String
Chef_mission = Forms![fm-demande OM]![Text2]
mission = Forms![fm-demande OM]![Text10]
'Détermine si la demande est individuelle ou collective
If Forms![fm-demande OM]![Text29] > 0 Then
collectif = "collectif"
Else
collectif = "individuel"
End If
'texte inséré dans le corps du mail
texte = "1- La demande d'ordre de marche doit d'abord être envoyée à votre chef de peloton." & _
vbCrLf & "2- Après l'accord de votre chef de peloton, le mail sera transféré au bureau cie." & _
vbCrLf & " " & _
vbCrLf & Chef_mission & " - demande d'ordre de marche " & collectif & " pour la mission ... " & mission
stDocName = "Demande ordre de marche"
DoCmd.SendObject acSendReport, stDocName, "rtf", "adresse mail de votre chef / adjoint de Pl, boîte mail de Sv Pl", , , "Demande d'ordre de marche " & collectif, [texte], True 'envoie en PJ sous forme HTML
Exit_Command51_Click:
Exit Sub
Err_Command51_Click:
Select Case Err.Number
Case 2501
MsgBox "Envoi du mail annulé"
Exit Sub
Case Else
MsgBox Err.Number & " : " & Err.Description
End Select
Resume Exit_Command51_Click
End Sub |
Partager