1

I'm trying to write a macro to send a canned reply. The issue I'm having is that the body of the text is too long to fit on one line in my code. I have no idea how to have a second paragraph of body text. I'm also trying to leave my name at the bottom of the reply -- signature style. I'm receiving an error when trying to run the macro stating that the line is too long. Can someone please, help me? This is what I've got so far.

Sub EmailReply()
Dim Reply As Outlook.MailItem
Dim Original As Outlook.MailItem
Set Original = Application.ActiveExplorer.Selection(1)
Set Reply = Original.Reply

Reply.Subject = "In reference to your inquiry."

Reply.Body = "Dear Client," & vbNewLine & vbNewLine & "     We thank you for consulting our firm regarding your legal issue. Unfortunately, upon a review of the information provided we are unable to assist you at this time. We encourage you to seek another legal option as there may be a strict statue of limitation that may extinguish your legal rights in your manner." & vbNewLine & "     Although you did not retain us in this matter, we encourage you to contact us in the future for any legal needs or questions that you may have. Of course, there is no charge for consultation."

Reply.Display

End Sub

3 Answers 3

1

Try using vbNewLine and _ like so:

Reply.Body = "Dear Person"  & vbNewLine & vbNewLine & _
"Line1" & vbNewLine & _
"Line2" & vbNewLine & _
"Line3" & vbNewLine & vbNewLine & _
"Sincerely," & vbNewLine & _
"Me"

vbNewLine represents a newline character

_ tells VBA that the current statement isn't finished.

0

I haven't used VBA in Ms Outlook or much of VBA at all but if there is a line length limit, you could define separate variables and concatenate them

e.g. a="asdf" b="qwert" c= a & vbNewLine & b

So, you know how to concatenate strings, as you already have, but you could just also, use separate variables

0

Do you want the text to appear in the email as multiple paragraphs or simply appear in the code as separate lines?

For the former:

eply.Body = "Dear Client," & vbNewLine & vbNewLine & "     We thank you for consulting our firm regarding your legal issue." & vbNewLine & vbNewLine & " Unfortunately, ..."

In other words, you need 2 vbNewLines together when entering just text (rather than an HTML formatted email).

In the later case:

"........"  & _
"... more text ..."

and so on.

You must log in to answer this question.