[VBA] Envoi mail avec PJ sans Outlook

Bonjour,

Voila mon problème, je souhaite via une macro en VBA imprimer un document en PDF et l'envoyer par mail (Lotus Notes) en PJ.

Je réussi à envoyer le tableau en PJ sans impression PDF, je réussis l'envoi via Outlook, par contre certains poste ou le fichier doit être utilisé est sous Lotus Notes. Et la est mon probleme, impossible de trouver le bon code.

J'ai essayer la fonction Sendmail, mais elle ne me propose pas l'ajout de PJ.

Voila actuellement mon code :

Set olApp = CreateObject("Outlook.application")  ' <---- On appel Outlook pour envoyer le mail
Set mail = olApp.CreateItem(olMailItem)

DestinataireBALF = Range("B27") ' <-- Bal 
TitreDuMail = "Analyse Post intervention " & Range("B18") & " Semaine " & Range("B20")

If DestinataireBALF = "" Then  ' <--- Si la BAL de reception est vide la procédure s'arrête

    AlerteMail = MsgBox("Vous n'avez pas sélectionné une BAL ", vbCritical, "Information obligatoire")

    Else

With mail

.to = DestinataireBALF
.Subject = TitreDuMail
.attachments.Add (FichierPDF)
.Send

End With

End If

Ce code fonctionne parfaitement, mais avec Outlook, mais impossible avec un autre client de messagerie.

Si quelqu'un a une solution

Cordialement.

Je remonte mon post.

Si quelqu'un a une solution, merci

Bonjour, je suis un peu dans ton cas, je cherche à éditer le PDF d'un onglet puis l'envoyer par mail (le tout en cliquant sur un bouton). As-tu réussis à envoyer ton PDF par mail ??

Bonjour,

je ne suis pas sous lotus mais à tester :

Sub Main
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim direct As Object
Dim Var As Variant
Dim flag As Boolean

Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.ISOPEN) Then flag = oDB.OPEN("", "")

If Not flag Then
MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
GoTo exit_SendAttachment
End If
On Error GoTo err_handler

'Building Message
Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.subject = "This is the subject"
oDoc.sendto = "adress1@mail.com"
oDoc.body = "This is test text in the body of the email"
oDoc.postdate = Date

'Attaching DATABASE
Call oItem.EmbedObject(1454, "", "c:\missing.txt")
oDoc.visable = True
'Sending Message
oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
'Done
Exit Sub
err_handler:
If Err.number = 7225 Then
MsgBox "File doesn't exist"
Else
MsgBox Err.number & " " & Err.description
End If
On Error GoTo exit_SendAttachment
End Sub  
Rechercher des sujets similaires à "vba envoi mail outlook"