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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| Public lstNo1 As Long
Public lstNo2 As Long
Sub TEST()
Dim objMail As Outlook.MailItem
Dim client As String
Dim TEXTE As String
Dim RMA As String 'RMA ou pas RMA
Dim Presta As String 'Sélection de la prestation
Unload UserForm3
Set objMail = Application.ActiveInspector.CurrentItem 'Execute la macro sur le mail actif
'Set objMail = Application.CreateItem(olMailItem) 'créé un nouvel email
objMail.HTMLBody = Remove 'Supprime le corps du message
objMail.BodyFormat = olFormatHTML 'Mail au format HTML
UserForm3.Show
Select Case lstNo1
Case -1
Presta = ""
Case 0
Presta = "devis de Réparation."
Case 1
Presta = "réparation sous Garantie."
Case 2
Presta = "prestation Métrologique."
End Select
Select Case lstNo2
Case -1
RMA = ""
Case 0
RMA = "<BODY><br><b><FONT face=Calibri>Afin que nous puissions intervenir sur votre instrument, " _
& "nous vous prions de compléter les formulaires joints (en PJ : ULS_RMA_fr V1.0.pdf).<br>" _
& "Des retards dans le traitement de la réparation de votre instrument sont à prévoir " _
& "si ces documents ne nous sont pas transmis dûment complétés.</b><br></FONT>"
Set myAttachments = objMail.Attachments 'Attacher le fichier RMA
myAttachments.Add "G:\Service\Avantec Interne\Documents type\courrier adv\ULS_RMA_fr V1.0.pdf", _
olByValue, 1, "Test"
Case 1
RMA = ""
End Select
objMail.Subject = UserForm3.TextBox1.Value + " : Votre " + UserForm3.TextBox2.Value 'Sujet du mail avec la variable
client = UserForm3.TextBox3.Value 'PoPup mail Client
TEXTE = "<BODY><FONT face=Calibri>Bonjour,<br><br>" _
& "Merci d'avoir choisi Unity Lab Services, marque de Thermo Fisher Scientific, comme partenaire pour le service de vos instruments.<br><br>" _
& "Nous avons bien réceptionné votre " + UserForm3.TextBox2.Value + " pour " + Presta + "<br><br>" _
& "Je suis le technicien en charge de votre appareil enregistré sous le numéro de notification " + "<b>" + UserForm3.TextBox1.Value + "</b>" _
& "<br><i><FONT color=red>(Merci de rappeler ce numéro lors de toute communication concernant cet appareil)</i></FONT><br>" + RMA + "<br>" _
& "Je reviendrais rapidement vers vous pour vous donner de plus amples informations sur l'avancement de votre dossier.<br><br>" _
& "N'hésitez pas à me contacter pour de plus amples informations.<br><br>" _
& "Cordialement.<br></FONT>" 'Création du mail avec mes variables
objMail.GetInspector.CommandBars.Item("Insert").Controls("Signature").Controls(1).Execute 'insertion de la signature
objMail.HTMLBody = TEXTE & objMail.HTMLBody 'permet d'afficher le texte et la signature
If client = "" Then 'Si client vide pas besoin de remplir le destinataire
objMail.Display
Else
Set theRecipientA = objMail.Recipients.Add(client) 'Insertion du destinataire
objMail.Display 'Affiche le mail avant expédition
End If
End Sub |
Partager