View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
William Benson[_3_] William Benson[_3_] is offline
external usenet poster
 
Posts: 27
Default Can't close e-mail

I don't understand why you have .display and .send in the same procedure.
Can't you just send it (if you don't want to view it) and if you do want to
view it, why not just send it manually?

"Brian Delaney" wrote in message
...
Hi,

From code I've seen in posts, I can't figure out why this won't work:
can't get the e-mail to close after it's been sent.

Dim Out As Outlook.Application, EM As MailItem

Set Out = New Outlook.Application

Set EM = Out.CreateItem(olMailItem)
With EM
.To = "Joe Smith"
.Subject = Range("A9").Value
.HTMLBody = Range("A11").Value & " " & Range("B11").Value
.display
.send
.Close
End With

This works fine until I include the .Close line. Then I get "Argument Not
Optional" (referring to .Close) and the procedure won't run.

Can anyone help? Thanks in advance,

Brian