A
adma
I have this code to send email using Excel macro, it works fine abut the
message stays in outbox until i open outlook then it sends it. how i can send
receive even if outlook closed?
any help? thanks!
Sub ComposeMail(strto As String, strSubject As String, strbody As String,
strAttachment As String)
Dim objOL As Outlook.Application
Dim objX As Outlook.MailItem
Set objOL = New Outlook.Application
Set objX = objOL.CreateItem(olMailItem)
With objX
> To = strto
> Subject = strSubject
> Body = strbody
If strAttachment <> "" Then
> Attachments.Add strAttachment
End If
> BodyFormat = olFormatHTML
> Display
End With
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
End Sub
message stays in outbox until i open outlook then it sends it. how i can send
receive even if outlook closed?
any help? thanks!
Sub ComposeMail(strto As String, strSubject As String, strbody As String,
strAttachment As String)
Dim objOL As Outlook.Application
Dim objX As Outlook.MailItem
Set objOL = New Outlook.Application
Set objX = objOL.CreateItem(olMailItem)
With objX
> To = strto
> Subject = strSubject
> Body = strbody
If strAttachment <> "" Then
> Attachments.Add strAttachment
End If
> BodyFormat = olFormatHTML
> Display
End With
Application.Wait (Now + TimeValue("0:00:02"))
Application.SendKeys "%s"
End Sub