Bug macro mail

Bonjour

Un petit problème, j'arrive pas à la lancer?

Une idée?

PrivatSub mm()

repertoireAppli = ActiveWorkbook.Path

Sheets("Commande").Copy

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs repertoireAppli & "\commande.xlsm"

ActiveWindow.Close

Dim ol As Object, monItem As Object

Set ol = CreateObject("outlook.application")

Dim msg As MailItem

Set olapp = New Outlook.Application

Set msg = olapp.CreateItem(olMailItem)

msg.To = "mail"

msg.Subject = "Commande " '

msg.Body = "Bonjour" & Chr(13) & Chr(13) & "Je vous prie de bien vouloir trouver ma commande"

msg.Attachments.Add Source:=repertoireAppli & "\commande.xlsm"

msg.Send

Set ol = Nothing

MsgBox "la demande a bien été transmise "

End Sub

Bonsoir,

Difficile à dire comme àa !

Un point m'interpelle : pourquoi on crée 2 objets Outlook ?

Set ol = CreateObject("outlook.application")
Set olapp = New Outlook.Application

Autre question : il y a une référence sur la librairie Outlook ?

Enfin, quel est le message d'erreur ?

A+

Bouben

Rechercher des sujets similaires à "bug macro mail"