ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SendMail Question (https://www.excelbanter.com/excel-discussion-misc-queries/26821-sendmail-question.html)

Andy Tallent

SendMail Question
 
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 Tallent

galimi

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.
--
http://HelpExcel.com
1-888-INGENIO
1-888-464-3646
x0197758


"Andy Tallent" wrote:

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 Tallent


Bob Phillips

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent




Andy Tallent

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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent





Ron de Bruin

Use display instead of Send

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

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Andy Tallent" wrote in message ...
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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent







Bob Phillips

Andy,

Then just change .Send to ,Display and it will open up but not send.

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent







Andy Tallent

Hi Ron,

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


"Ron de Bruin" wrote:

Use display instead of Send

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

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Andy Tallent" wrote in message ...
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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent







Ron de Bruin

If you want to add more text see also
http://www.rondebruin.nl/mail/tips2.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Andy Tallent" wrote in message ...
Hi Ron,

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


"Ron de Bruin" wrote:

Use display instead of Send

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

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Andy Tallent" wrote in message
...
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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent









Andy Tallent

Thank you Bob,

Kind Regards
--
Andy Tallent


"Bob Phillips" wrote:

Andy,

Then just change .Send to ,Display and it will open up but not send.

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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


--
Andy Tallent


"Bob Phillips" wrote:

The only other argument seems to be return receipt, so it looks like no.

If you have Outlook, you could build an email via automation which can
handle this. There is an example here
http://www.xldynamic.com/source/xld.EarlyLate.html

--
HTH

Bob Phillips

"Andy Tallent" wrote in message
...
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 Tallent








All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com