Amis du forum bonjour
Après une longue absence, me voici pour demander un conseil.
Je travaille sous Excel 2007, mais aussi avec Outlook 2003(directives patronales).
Le problème rencontré est le suivant.
Quand dans Excel 2007 je veux créer des mails sous Outlook 2003, le système me regénère la création d'office 2003: assez gênant.
Voici le code :
Quelqu'un pourrait-il m'aider, merci d'avance
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
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 Sub création_mails() 'détermination de l'émetteur expéditeur = "Service.Pilotage-Chq@toto.com" séparation = "__________________________________________________" séparation2 = "_________________________________________________________" 'détermination de variables Binôme_Expéditeur = "a et b " expéditeur_final = Left(Application.UserName, Len(Application.UserName) - 10) titre_1 = "Chef " titre_2 = "Service.Pilotage-Chq@toto2.com" telephones = " Tél. xx" & Chr(10) & " Tél. xx" 'Destinataire = "resp_agence/" & agence & "%diffusion@sib.fr.socgen.com" & ";" & "adj_resp_agence /" & agence & "%diffusion@sib.fr.socgen.com""" If expéditeur_final = "a" Then copies = "b@socgen.com" If expéditeur_final = "b" Then copies = "a@socgen.com" messagerie = "a - Tél. xx" & "<br>" & "b - Tél. xx " & "<br>" body1 = "<font style='font-family: Arial;font-size: 10pt ;'" & "color=#000000>" & "Nos outils de pilotages révèlent une absence de données." & "<br>" body2 = "Un problème technique étant toujours possible, pourriez-vous nous en indiquer les raisons ?" & "<br><br>" body3 = "Ceci étant, si besoin est, nous vous invitons à prendre contact avec la Hot-Line au xx." & "<br><br>" body4 = "Nous vous remercions par avance de votre collaboration." & "<br>" Message = body1 & body2 & body3 & body4 ' Initialisation des Messages Set myOlApp = CreateObject("Outlook.Application") Set myItem = myOlApp.CreateItem(0) 'Rappatriement de l'icone Set colAttach = myItem.Attachments Set I_Attach = colAttach.Add("V:\BASE INCIDENTS\icone.jpg") myItem.Close olSave strEntryID = myItem.EntryID Set myItem = Nothing Set colAttach = Nothing Set I_Attach = Nothing Set oSession = CreateObject("MAPI.Session") oSession.Logon "", "", False, False Set oMsg = oSession.GetMessage(strEntryID) Set oAttachs = oMsg.Attachments Set oAttach = oAttachs.Item(1) Set colFields = oAttach.Fields Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg") Set oField = colFields.Add(&H3712001E, "myident") oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True oMsg.Update Set myItem = myOlApp.GetNamespace("MAPI").GetItemFromID(strEntryID) 'Création et envoi du mail With myItem .Subject = "DEC : " & DEC & " Agence : " & agence & " " & nom_agence & " / Absence De données le " & jour_traité .Htmlbody = "<font style='font-family: Arial;font-size: 10pt ;'" & "color=#000000>" & "Bonjour, " _ & "<br><br>" & Message _ & "<br>" & "Bien Cordialement." _ & "<br><br>" & séparation _ & "<br><br>" & "<IMG align=baseline border=0 hspace=0 src=cid:myident>" _ & "<b><br><br>" & "<font style='font-family: Arial;font-size: 10pt ;'" & "color=#000000>" & Binôme_Expéditeur _ & "</b><br>" & "<font style='font-family: Arial;font-size: 8pt ;'" & "color=#000000>" & titre_1 _ & "<br><br>" & "<font style='font-family: Arial;font-size: 8pt ;'" & "color=#000000>" & "e-mail : " & titre_2 _ & "<br><br>" & "<font style='font-family: Arial;font-size: 8pt ;'" & "color=#000000>" & messagerie _ & séparation2 End With myItem.SentOnBehalfOfName = expéditeur myItem.cc = copies myItem.display 'suite du test End If End If End Sub
Partager