Adding Leading Spaces (Indent) to StrBody (Outlook Email)

LBinGA

Board Regular
Joined
Jan 29, 2014
Messages
57
Hi all:

I would like to indent the bullet points and align the text under each bullet point in the following code. As you can see, I've tried several ways to do that but no matter what I try, it comes out left justified.

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


    strbody = "[SIZE=2][FONT=Arial]Hello " & Sheets("IRF Worksheet").Range("a703").Value & ", [/FONT][/SIZE][FONT=Arial][SIZE=2]" & _
                "Our conditional Select Renewal Quote is attached.  It is based on the insured's expiring exposure information and is conditioned upon satisfaction of the renewal criteria outlined in the quote letter. The attached Select Renewal Quote will remain valid until " & Sheets("IRF Worksheet").Range("M9").Value & "." & _
                "If you would like to bind on the basis of this Select Renewal Quote:" & _
               [B] "•" & Space(10) & "[/B]  Please confirm that all of the renewal criteria indicated on the quote letter have been met via your bind request. " & _
               [B] Space(10) & "•" & "[/B]  Bind request can be either by email OR by signing (electronically or otherwise), dating and providing the policy number, if available, in the                   designated places near the bottom of the Select Renewal Quote Letter. " & _
             [B]   "          " & "•" & "[/B]  Return to me or " & Sheets("IRF Worksheet").Range("b3").Value & ". " & _
                "Please let me know if you have any questions." & _
                "Sincerely," & _
                "Sent on behalf of " & Sheets("IRF Worksheet").Range("b3").Value & ""


    On Error Resume Next
 
 Recipient = Sheets("Select Ren").Range("a72").Value


    With OutMail
        .Display
        .To = Recipient
        .CC = ""
        .BCC = ""
        .subject = "Select Renewal QUOTE:  " & Sheets("Select Ren").Range("f11").Value
        .HTMLBody = strbody & "
" & .HTMLBody
        .Attachments.Add PDF_File
        .Save
        .Display
        
    End With[/SIZE][/FONT]


I'd like it to look like this when activated:

If you would like to bind on the basis of this Select Renewal Quote:

10 spaces • Please confirm that all of the renewal criteria indicated on the quote letter have been met via your bind request.
10 spaces • Bind request can be either by email OR by signing (electronically or otherwise), dating and providing the policy number, if available, in
13 spaces the designated places near the bottom of the Select Renewal Quote Letter.
10 spaces • Return to me or <>.

Please let me know if you have any questions.

Thank you,
LBinGA;)
 
Last edited:

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Since you're using the HTMLBody property, you can use HTML tags. Try building your string like this...

[Note: A space has been added after each instance of "<" to prevent the Board from interpreting it as HTML code. Therefore, remove those spaces from the code.]

Code:
        strBody = ""
        strBody = strBody & "< p>Here's a list of bulleted items:< /p>" & vbCrLf
        strBody = strBody & "< ul>" & vbCrLf
        strBody = strBody & "< li>Bullet number one< /li>" & vbCrLf
        strBody = strBody & "< li>Bullet number two< /li>" & vbCrLf
        strBody = strBody & "< li>Bullet number three< /li>" & vbCrLf
        strBody = strBody & "< /ul>" & vbCrLf
        strBody = strBody & "< p>That's the end of the list.< /p>"

Hope this helps!
 
Last edited:
Upvote 0
Since you're using the HTMLBody property, you can use HTML tags. Try building your string like this...

[Note: A space has been added after each instance of "<" to prevent the Board from interpreting it as HTML code. Therefore, remove those spaces from the code.]

Code:
        strBody = ""
        strBody = strBody & "< p>Here's a list of bulleted items:< /p>" & vbCrLf
        strBody = strBody & "< ul>" & vbCrLf
        strBody = strBody & "< li>Bullet number one< /li>" & vbCrLf
        strBody = strBody & "< li>Bullet number two< /li>" & vbCrLf
        strBody = strBody & "< li>Bullet number three< /li>" & vbCrLf
        strBody = strBody & "< /ul>" & vbCrLf
        strBody = strBody & "< p>That's the end of the list.< /p>"

Hope this helps!

PERFECT! Thank you. I also removed the carriage returns as they were needed. Final result was:
Code:
strbody = ""        strbody = strbody & "Hello " & Sheets("IRF Worksheet").Range("a703").Value & ", 
"strbody = strbody & "Our conditional Select Renewal Quote is attached.  It is based on the insured's expiring exposure information and is conditioned upon satisfaction of the renewal criteria outlined in the quote letter. The attached Select Renewal Quote will remain valid until " & Sheets("IRF Worksheet").Range("M9").Value & ". "strbody = strbody & "
[LIST]"strbody = strbody & "
[*]Please confirm that all of the renewal criteria indicated on the quote letter have been met via your bind request."strbody = strbody & "
[*]Bind request can be either by email OR by signing (electronically or otherwise), dating and providing the policy number, if available, in the designated places near the bottom of the Select Renewal Quote Letter."strbody = strbody & "
[*]Return to me or " & Sheets("IRF Worksheet").Range("b3").Value & "."strbody = strbody & "
[/LIST]
"strbody = strbody & "Sincerely,"
        strbody = strbody & ""
        strbody = strbody & "Sent on behalf of " & Sheets("IRF Worksheet").Range("b3").Value & ". 
"

I've struggled with this for a couple hours. I should have asked here first! :eek:

Thanks again!
LBinGA
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,955
Messages
6,127,927
Members
449,411
Latest member
AppellatePerson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top