mutley1
MIS
- Jul 24, 2003
- 909
I know i posted this in another thread, but I have found what seems to be a simple VBA to run the send of a message over 255 chars. Problem is, when I put the entire text of the email in, it doen not seem to like it and it auto add's speech marks etc. in the message body. Code is below.
What I have is a screen with a mail button and when the user clicks it, Iwant Outlook to open a mail and include the following text:
So basically, click the button and the email is auto populated with this message.
Thanks in advance.
M
Code:
Sub SendMessage(DisplayMsg As Boolean, Optional AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Nancy Davolio")
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Michael Suyama")
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("Andrew Fuller")
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = "This is an Automation test with Microsoft Outlook"
.Body = "This is the body of the message." &vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each ObjOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Sub
What I have is a screen with a mail button and when the user clicks it, Iwant Outlook to open a mail and include the following text:
Code:
Dear Client,
Please see attached a link to the payer list as requested. Tou may wish to bookmark this link for future usage.
[URL unfurl="true"]http://www.mylink/sfsddd/uyuy/list.asp[/URL]
Thank you again for choosing my company and we look forward to future dealings with youeself.
If you have any question, please contact us on the number below, selecting option 1 for enrollment or option 2 for support.
Thanks and have agreat day
EDI Support
My Company
Phone # 800 111 2345
M.
Thanks in advance.
M