SendMail Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am using the following code to attached a spreadsheet to an outlook message.

Application.Dialogs(xlDialogSendMail).Show _
arg1:=Sheets("Sheet1").Range("A1"), _
arg2:=Sheets("Sheet1").Range("A2")

I am able to specify a e-mail address with arg1 and subject with arg2 but
does anybody know if it is possible to specify some content for the body of
the e-mail message?

Thanks
 
Andy,

I find it much more convenient to make a reference to the Outlook Library
and send mail messages that way. There are methods to include messages in
the body of the email.
 
Hi Bob,

Thanks for this guidance. Perhaps I need to approach this in a different
way. I've tried also using some code from Ron de Bruins site (i think) which
does everything I want except that it automatically sends the mail and I
don't want this to happen. I want the e-mail message to be displayed as per
"Application.Dialogs(xlDialogSendMail).Show" so that the user can intervene
and add more text to the body. Is this possible at all using his code?

Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = Sheets("Sheet1").Range("A1")
.CC = ""
.BCC = ""
.Subject = Sheets("Sheet1").Range("A2")
.Body = Sheets("Sheet1").Range("A3")
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing


Application.Quit
 
Use display instead of Send

You can see that in all my examples
.Send 'or use .Display
 
Hi Ron,

Thank you very much, this works perfectly. I feel a bit sheepish as it was
so simple....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top