Bonjour à tous,
J'aimerais créer une tâche avec un format de texte enrichi dans le body. Je pensais que cela serait identique à la création d'un courriel
mais ça ne fonctionne pas. j'ai aussi essayé .rtfbody = sBody
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 .BodyFormat = olFormatHTML .HTMLBody = sBody
Voici le code utilisé
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 Function Task_Mapi(sSubject As String, sBody As String, _ dtDueDate As Date, _ dtReminderDate As Date) On Error GoTo Error_Handler Const olTaskItem = 3 Dim OlApp As Object Dim OlTask As Object Set OlApp = CreateObject("Outlook.Application") Set OlTask = OlApp.CreateItem(olTaskItem) With OlTask .Subject = sSubject .DueDate = dtDueDate .Status = 1 '0=not started, 1=in progress, 2=complete, 3=waiting, '4=deferred .Importance = 1 '0=low, 1=normal, 2=high .ReminderSet = True .ReminderTime = dtReminderDate .Categories = "" 'use any of the predefined Categorys or create your own .Body = sBody .Display End With Error_Handler_Exit: On Error Resume Next Set OlTask = Nothing Set OlApp = Nothing Exit Function Error_Handler: MsgBox "The following error has occured" & vbCrLf & vbCrLf & "Error Number: " & _ Err.Number & vbCrLf & "Error Source: AddOlkTask" & vbCrLf & "Error Description: " & _ Err.description, vbCritical, "An Error has Occured!" Resume Error_Handler_Exit End Function
merci à l'avance pour votre aide
Partager