ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Body for e-mail using sendMail (https://www.excelbanter.com/excel-programming/340496-body-e-mail-using-sendmail.html)

Tempy

Body for e-mail using sendMail
 
Hi all, i am using ActiveWorkbook.SendMail mySuppName, "Latest
Reconciliation " & myDate, True
To send an e-mail and it works great, i just need to write a message, as
the above only has the possibility to put in the address and the subject
?
Any suggestions or help would be appreciated.



Tempy

*** Sent via Developersdex http://www.developersdex.com ***

JNW

Body for e-mail using sendMail
 
Try the following instead of send mail:

Sub email()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String

EmailAddr = "
Subj = "Your subject"

BodyText = "your subject"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.to = EmailAddr
.CC = ""
.BCC = ""
.Subject = Subj
.Body = BodyText
.Attachments.Add ActiveWorkbook.FullName
.Display 'or use .send
End With

Set OutMail = Nothing
Set OutApp = Nothing
End sub

"Tempy" wrote:

Hi all, i am using ActiveWorkbook.SendMail mySuppName, "Latest
Reconciliation " & myDate, True
To send an e-mail and it works great, i just need to write a message, as
the above only has the possibility to put in the address and the subject
?
Any suggestions or help would be appreciated.



Tempy

*** Sent via Developersdex http://www.developersdex.com ***


Tempy

Body for e-mail using sendMail
 
Thanks JNW, will try it in the morning as It is now 18:45 here and way
past me home time !!

thanks again.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

Body for e-mail using sendMail
 
This is only working if the OP is using Outlook
For other code see
http://www.rondebruin.nl/sendmail.htm


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


"JNW" wrote in message ...
Try the following instead of send mail:

Sub email()
Dim OutApp As Object
Dim OutMail As Object
Dim EmailAddr As String
Dim Subj As String
Dim BodyText As String

EmailAddr = "
Subj = "Your subject"

BodyText = "your subject"

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.to = EmailAddr
.CC = ""
.BCC = ""
.Subject = Subj
.Body = BodyText
.Attachments.Add ActiveWorkbook.FullName
.Display 'or use .send
End With

Set OutMail = Nothing
Set OutApp = Nothing
End sub

"Tempy" wrote:

Hi all, i am using ActiveWorkbook.SendMail mySuppName, "Latest
Reconciliation " & myDate, True
To send an e-mail and it works great, i just need to write a message, as
the above only has the possibility to put in the address and the subject
?
Any suggestions or help would be appreciated.



Tempy

*** Sent via Developersdex http://www.developersdex.com ***




Tempy

Body for e-mail using sendMail
 
Hi Ron, thank you very much. Just one more question, i see you can wrap
the text if you put it in the code.
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

How would one wrap the text put in via an input box ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***

Ron de Bruin

Body for e-mail using sendMail
 
Hi

Use this then

strbody = InputBox("Enter your text")


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


"Tempy" wrote in message ...
Hi Ron, thank you very much. Just one more question, i see you can wrap
the text if you put it in the code.
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"

How would one wrap the text put in via an input box ?

Tempy

*** Sent via Developersdex http://www.developersdex.com ***





All times are GMT +1. The time now is 09:40 AM.

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