Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get mulitple BODY text lines in Outlook when using a script??

Status
Not open for further replies.

donafran

Programmer
Jul 11, 2002
71
US
Can anyone help me ??

I believe I am using Rich Text Format.

Here is the exact Script:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sub Main()

Dim objOutlook As Object
Dim objOutlookMsg As Object


rem ********** send e-mail ***********************************************

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "Dona.peschko@bicworld.com"
.Subject = "TEST of Auto- Daily Reports"
.Body = "Daily Numbers generated via scripts on Cognos Servers" & vbCRLF
.Body = .Body & VbCRLF & "Please contact me if you have questions."
.Send
End With

Set objOutlook = Nothing
Set objOutlookMsg = Nothing


End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Here is the EXACT output of this script:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Daily Numbers generated via scripts on Cognos ServersPlease contact me if you have questions.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Please let me know if there are any other things I might try. Thanks for your replies
 
Assign your message to a variable. Try something like this:

strMsg = "Daily Numbers generated via scripts on Cognos Servers" & vbCRLF
strMsg = strMsg & VbCRLF & "Please contact me if you have questions."

.Body = strMsg

Hope this helps!

mapman04
 
OK - I changed trhe script to below, with the SAME effect.
All I am trying to do is force the last sentence to be on a separate line from the first sentence.


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sub Main()

Dim objOutlook As Object
Dim objOutlookMsg As Object
dim msg1 as string



rem ********** send e-mail ***********************************************

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = "Dona.peschko@bicworld.com"
.Subject = "TEST of Auto- Daily Reports"
msg1 = "Daily Numbers generated via scripts on Cognos Servers" & VbCRLF
msg1 = msg1 & "Please contact me if you have questions."
.Body = msg1
.Send
End With

Set objOutlook = Nothing
Set objOutlookMsg = Nothing


End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
Have you tried this ?
.BodyFormat=1 'olFormatPlain

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Here's a script that I have that uses CDO to send the message. I actually read an entire text file into a variable then create an e-mail with the contents of the text file. I could e-mail the script if you would like it. Here's the CDO code.

Dim sTo,strLoc,strFname,strSubject,strText,oSession,oMessage,oAttachment,oRecipient

'Sending e-mail
sTo="SMTP:User@acorp.com"
strSubject = "Daily Report"
strText = strMsg
set oSession=CreateObject("MAPI.Session")
oSession.Logon "User"
set oMessage=oSession.Outbox.Messages.Add(strSubject,strText)
set oRecipient=oMessage.Recipients.Add(,sTo)
oRecipient.Resolve
oMessage.Send
oSession.Logoff
set oSession=nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top