can i color specific line in email send by excel

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
This answers a follow-up question that appeared on the Chandoo thread, how to insert a picture from worksheet to email body:

VBA Code:
Sub ExportPic(fname$)
Dim MyChart$, MyPicture$, PicWidth&, PicHeight&, sr As ShapeRange
Set sr = ActiveSheet.Shapes.Range(Array("imagem 7"))    ' desired picture
Application.ScreenUpdating = False
MyPicture = sr.Name
PicHeight = sr.Height: PicWidth = sr.Width
Charts.Add
ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
Selection.Border.LineStyle = 0
MyChart = Selection.Name & " " & Split(ActiveChart.Name, " ")(2)
With ActiveSheet
    With .Shapes(MyChart)
        .Width = PicWidth
        .Height = PicHeight
    End With
    .Shapes(MyPicture).Copy
    With ActiveChart
        .ChartArea.Select
        .Paste
    End With
    .ChartObjects(1).Chart.Export Filename:=fname, FilterName:="jpg"
    .Shapes(MyChart).Cut
End With
Application.ScreenUpdating = True
End Sub

Sub mail()
Dim myitem As MailItem, olApp, fname$
fname = "c:\pub\Pic30.jpg"
ExportPic fname                                 ' from sheet to hard disk
Set olApp = CreateObject("Outlook.Application")
Set myitem = olApp.CreateItem(olMailItem)
With myitem
    .To = "nice@educated.com"
    .cc = ""
    .Subject = "Free Help"
    .Attachments.Add fname, 1, 0
    .HTMLBody = "<html><p>Summary of Status.</p>" & _
    "<img src=""cid:" & Split(fname, "\")(2) & """height=520 width=750>"
    .Display
End With
Set myitem = Nothing: Set olApp = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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