bonjour
j'ai adapter un macro pour envoyer un mail et ça marche très bien, lorsque le Outlook de la récepteur est fermer ne fonctionne pas?
voici mon macro:
'---http://www.vbaexpress.com/kb/getarticle.php?kb_id=758
'--- pas d'ouverture / fermeture OUTLOOK
Dim blRunning As Boolean
'get application
blRunning = True
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
'Specify the email subject
.Subject = "My email with attachment"
'Specify who it should be sent to
'Repeat this line to add further recipients
.To = "Mohamed-moez.bali@onetech-group.com"
'.Recipients.Add "xxx@yahoo.com" 'name@host.com"
'specify the file to attach
'repeat this line to add further attachments
.Attachments.Add "D:\Scaling\envoyeur.xlsx"
'specify the text to appear in the email
.Body = "Here is an email"
'Choose which of the following 2 lines to have commented out
'.Display 'This will display the message for you to check and send yourself
.Send ' This will send the message straight away
End With
If Not blRunning Then olApp.Quit
Set olApp = Nothing
Set olMail = Nothing
End Sub
j'ai adapter un macro pour envoyer un mail et ça marche très bien, lorsque le Outlook de la récepteur est fermer ne fonctionne pas?
voici mon macro:
'---http://www.vbaexpress.com/kb/getarticle.php?kb_id=758
'--- pas d'ouverture / fermeture OUTLOOK
Dim blRunning As Boolean
'get application
blRunning = True
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
With olMail
'Specify the email subject
.Subject = "My email with attachment"
'Specify who it should be sent to
'Repeat this line to add further recipients
.To = "Mohamed-moez.bali@onetech-group.com"
'.Recipients.Add "xxx@yahoo.com" 'name@host.com"
'specify the file to attach
'repeat this line to add further attachments
.Attachments.Add "D:\Scaling\envoyeur.xlsx"
'specify the text to appear in the email
.Body = "Here is an email"
'Choose which of the following 2 lines to have commented out
'.Display 'This will display the message for you to check and send yourself
.Send ' This will send the message straight away
End With
If Not blRunning Then olApp.Quit
Set olApp = Nothing
Set olMail = Nothing
End Sub