XL 2010 Joindre fichier EXCEL avec Outlook

corsu2a

XLDnaute Occasionnel
Bonjour
J'utilisais jusqu’à maintenant une macro simple qui ouvrait la fenêtre d'envoi avec la PJ, mais les gens qui n'ouvraient pas Outlook, le mail se plaçuait dans la boite d'envoi.

Inclut la PJ dans le corps du mail :
Sub envoi_mail()
'
' envoi_mail Macro
'
'
Application.Dialogs(xlDialogSendMail).Show
End Sub


Ouvre Outlook et envoie
Je dois rajouter a ma macro, l'ouverture de Outlook, j'ai cette macro mais elle ne joint pas le document excel, elle ouvre et envoi le mail sans pièces jointe. Est il possible d'integrer la macro simple

Merci pour votre aide.

Sub SendMail_Outlook()
Dim OL As Object
Dim OLmail As Object
Set OLk_Appli = CreateObject("Outlook.Application")
If OLk_Appli.Explorers.Count > 0 Then
'Ok outlook ouvert
Else
'mettre le bon chemin outlook
OLk_OK = Shell("C:\Program Files\Microsoft Office\Office16\outlook.exe", vbHide)
End If
Set OL = CreateObject("Outlook.Application")
Set OLmail = OL.CreateItem(0)
With OLmail
.To = "..............@aol.com;DDDffs@dddff.fr"
.Subject = "Feuille de garde FDF"
.Body = "azerty"
'.display
.Send
End With
Set OLmail = Nothing
Set OL = Nothing
Set OLk_Appli = Nothing
End Sub



Merci pour tout.
 

Lone-wolf

XLDnaute Barbatruc
Bonjour Corsu2a

Pourquoi 2 fois " Set OLk_Appli = CreateObject("Outlook.Application") " + Shell??? o_O

En plus, il manque le chemin du fichier

VB:
Sub CommandButton()
Dim olApp As Object
Dim olMail
Dim fichier$

    Set olApp = CreateObject("Outlook.Application")
    Set olMail = olApp.CreateItem(0)
    fichier = "" 'ICI CHEMIN COMPLET DU FICHIER À ENVOYER
    With olMail
        .To = "toto@amoto.roule"
        .Subject = "Feuille de garde FDF"
        .BCC = ""
        .Body = "azerty"
        .Attachments.Add fichier
        .Display    'Pour visualiser
        '.Send      'Envois direct
    End With
    Set olMail = Nothing
    Set olApp = Nothing
End Sub

Et à combien de personne tu veux joindre le fichier? :rolleyes:
 

Discussions similaires

Réponses
2
Affichages
265

Statistiques des forums

Discussions
312 305
Messages
2 087 079
Membres
103 455
dernier inscrit
saramachado