Je galère moi-même avec cette question.
Effectivement, tout est dans le titre... et rien n'est dans le corps de ton message.
La boule de cristal n'est pas une option dans l'inscription à ce forum (quoiqu'il faudrait y penser).
Regarde ma signature et clique sur le lien URL proposé.
Tu auras certainement plus de chances - si consignes respectées - de trouver une solution à ton problème.
Voici deux façons de faire, ne pas oublier de cocher la référence Microsoft Outlook Object Library.
Code:
Sub Envoi_Mail()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim StrBody As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
StrBody = "Bonjour Monsieur," & vbCrLf & vbCrLf & "bien dormi cette nuit ?"
With olMail
.To = ""
.CC = ""
.Subject = "Message rappel"
.Body = StrBody
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
Code:
Sub Envoi_Mail()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim StrBody As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
StrBody = "<HTML><Body><p><Span style='font-family:Tahoma;font-size:10pt'>Bonjour Mesdames et Messieurs.</p>" _
& "<p>Soyez les bienvenus à cette réunion concernant le projet</span></p>" _
& "<p><Span style='color:blue;font-family:Tahoma;font-size:16pt'><b><i><center>NEW STRATEGY</center></i></b></span></p>" _
& "<p><center><img src='C:\meeting.gif'></center></p></Body><HTML>"
With olMail
.To = ""
.BCC = ""
.Subject = "Projet NEW STRATEGY"
.HTMLBody = StrBody
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
Voici deux façons de faire, ne pas oublier de cocher la référence Microsoft Outlook Object Library.
Code:
Sub Envoi_Mail()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim StrBody As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
StrBody = "Bonjour Monsieur," & vbCrLf & vbCrLf & "bien dormi cette nuit ?"
With olMail
.To = ""
.CC = ""
.Subject = "Message rappel"
.Body = StrBody
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
Code:
Sub Envoi_Mail()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Dim StrBody As String
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
StrBody = "<HTML><Body><p><Span style='font-family:Tahoma;font-size:10pt'>Bonjour Mesdames et Messieurs.</p>" _
& "<p>Soyez les bienvenus à cette réunion concernant le projet</span></p>" _
& "<p><Span style='color:blue;font-family:Tahoma;font-size:16pt'><b><i><center>NEW STRATEGY</center></i></b></span></p>" _
& "<p><center><img src='C\meeting.gif'></center></p></Body><HTML>"
With olMail
.To = ""
.BCC = ""
.Subject = "Projet NEW STRATEGY"
.HTMLBody = StrBody
.Display
End With
Set olMail = Nothing
Set olApp = Nothing
End Sub
@serdar: c'est la ligne & "<p><center><img src='C:\meeting.gif'></center></p></Body><HTML>" qui cause problème.
Il faut la supprimer, vu que tu n'as pas cette image. Sinon tu place une image dans le disque C et tu mets le nom de l'image qu tu as.
Il faut aussi corriger en mettant C:\ au lieu de C\. désolé pour l'erreur commise.