Table in email

RobbertH

Active Member
Joined
Apr 29, 2008
Messages
310
Hi guys,

Im struggling with the following and i hope i could find some help here.

In the body text of an email which im sending from excel i'd like to include the entries of some range in my excel file. The entries in the range are in a text format and range from F14 to max F50 but the range length will differ. I'd like to show the entries as a simple list somewhere in the middle of my email body text. When there is no entry in one of the cells in the range F14 to F50 i obviously dont want to have an enter in the list in the body text of the email.

Is this even possible?
I hope i am being clear enough.

Thanks for any help.

ps. I tried to populate one cell my file with the data i want. This cell Im able to refer to in my body text. However, the problem is that I wont get rid of the empty cells in my range. This results in a very long list of enters in my body text.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Something along these lines?
If the cell is empty then it's not added to strtable

Slightly modified from a version I posted a while back
http://www.mrexcel.com/forum/showthread.php?t=551464

Code:
Sub mail_text_html()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim Req As String
Dim qty1 As String
 
FirstRow = 14
LastRow = 50
 
For r = FirstRow To LastRow
'Column F=6
For Each cell In Cells(r, 6)
If cell.Value <> "" Then
strtable = strtable & cell.Value & vbNewLine
Else
strtable = strtable
End If
Next
Next
strbody = "Body Text"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
 On Error Resume Next
        With OutMail
            .Subject = EmailSubject
            .To = EmailSendTo
            .body = strbody & vbNewLine & vbNewLine & strtable
            .Display
           '.Send
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

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