Bonjour à tous,

Dans un fichier Excel, je génère un fichier *pdf que je joins ensuite à un message outlook que je souhaiterais pouvoir envoyer en différé.

Est-il possible d'intégrer dans ma procédure sous XL le paramétrage correspondant au menu d'outlook : Options/Différer la livraison.

Merci de votre aide

Philippe

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
 
'---------------------------------------------------------------------------------------
' Procedure : RDB_Mail_PDF_Outlook
' Author    : Ron de Bruin (http://www.dailydoseofexcel.com/archives/2009/03/08/update-vba-code-page-for-tables-and-createmail-pdf-files/)
' Date      : 1 Sept 2009
' Purpose   :
'---------------------------------------------------------------------------------------
'
Function RDB_Mail_PDF_Outlook(FileNamePDF As String, StrTo As String, _
        StrSubject As String, StrBody As String, Send As Boolean)
    Dim OutApp As Object
    Dim OutMail As Object
 
    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)
 
    On Error Resume Next
    With OutMail
        .To = StrTo
        .CC = ""
        .BCC = ""
        .Subject = StrSubject
        .Body = StrBody
        .Attachments.Add FileNamePDF
 
        If Send = True Then
            .Send
        Else
            .Display
        End If
    End With
    On Error GoTo 0
 
    Set OutMail = Nothing
    Set OutApp = Nothing
End Function