Bonjour,
Je souhaite faire un mail en vba excel seulement j'ai remarque que si je fait une recherche dans l'annuaire outlook et que je laisse la fenêtre de propriété d'une personne choisi dans OUTLOOK : je lance mon appli VBA pour faire un mail automatique ==> erreur débogage au moment que le code lit :".display" .
enfin de compte l'erreur est provoque que si cette fenetre est ouverte : comment y remédier svp
voila le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub CommandButton7_Click() Dim co As String Dim co2 As String UserForm11.Show UserForm12.Show If UserForm11.TextBox1.Value = "Oui" Then co = "Green" End If If UserForm11.TextBox1.Value = "Non" Then co = "Red" End If If UserForm12.TextBox1.Value = "Oui" Then co2 = "Green" End If If UserForm12.TextBox1.Value = "Non" Then co2 = "Red" End If 'Avant de lancer cette macro, Dans l'éditeur VBA: Faire Menu / Tools / 'Reference / Cocher "Microsoft 'Outlook Library" Dim ol As New Outlook.Application Dim olmail As MailItem Dim CurrFile As String Set ol = New Outlook.Application Set olmail = ol.CreateItem(olMailItem) With olmail .To = "adresse@email.fr" .Subject = "Application non trouvée" .HTMLBody = "<HTML><body><span style=""font-size: 13.5; font-family: Arial;"">Bonjour,<br><br>L'application <b><font color=Blue>" & TextBox1.Value & "</font></b> n'est pas disponible :<br><br>Disponible dans le référentiel applicatif : <b><font color=" & co & ">" & UserForm11.TextBox1.Value & "</font></b><br>Disponible dans BMC REMEDY : <b><font color=" & co2 & ">" & UserForm12.TextBox1.Value & "</font></b><br><br><br></span>" _ & "<HTML><body></font><span style=""font-size: 13.5; color:navy; font-family: Arial;"">Opérations - Agence <br>Informatique - Etablissement <br>Tél. : 01.58</span><br><span style=""font-size: 24; color:green""><font face='webdings'>ü</font></font></span><span style=""font-size: 10; color:green; font-family: Arial"">Jouons le jeu de l'environnement. Ne gaspillons pas ! N'imprimez ce mail que si nécessaire.</span><span style=""font-size: 24; color:green""><font face='webdings'>ü</font></font></span>" .BodyFormat = olFormatHTML .Display
Partager