Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Can't close e-mail

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
Error: cannot load the mail service. Check your mail installation. Brad Bowser Excel Discussion (Misc queries) 0 December 20th 05 10:03 PM
Creating TWO-WAY E-Mail Attachments with 'BeforeSave Events' in Code for 2nd E-Mail Chuckles123[_112_] Excel Programming 0 September 8th 05 05:56 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
excel - Windows close button (x) should only close active workboo. CoffeeAdict Setting up and Configuration of Excel 3 February 8th 05 04:30 AM


All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"