diddi
Well-known Member
- Joined
- May 20, 2004
- Messages
- 3,337
- Office Version
- 2010
- Platform
- Windows
greets all
below is a sub which sends an attachment via Outlook. Its a rip off from Ron Debruin (thx).
All works as expected except that the email is sent to the Outlook outbox, but does not actually get sent unless I open Outlook. How can i send without opening Outlook?
TIA
below is a sub which sends an attachment via Outlook. Its a rip off from Ron Debruin (thx).
All works as expected except that the email is sent to the Outlook outbox, but does not actually get sent unless I open Outlook. How can i send without opening Outlook?
TIA
Code:
Sub SendMail(ToRecipient As String, AttachDesc As String)
Dim OlApp As Object, OlMail As Object
Set OlApp = CreateObject("Outlook.Application")
Set OlMail = OlApp.createitem(olmailitem)
With OlMail
.Recipients.Add ToRecipient
.Subject = AttachDesc & " from ----"
.Attachments.Add "D:\RAPDFs\" & AttachDesc
.Send
End With
Set OlMail = Nothing
Set OlApp = Nothing
End Sub