title: Excel macro to email tables and graphs via Outlook
body: <p>I am trying to send Automate mail from Excel via Outlook mail to users. Within that i have requirement to send some Excel tables and graphs to certain users. The excel table should be placed after some text provided/written by sender and should retain the same table format in the email. </p>
  
  <p>I am not able to get this functionality automate (sending excel table and graph in the email body) and require your help in sorting this out. </p>
  
  <p>PS: I am using excel/Outlook 2010 (win)</p>
  
  <p>Below is my overall code written as of now:</p>
  
  <pre><code>Sub Mail_to_MgmtTeam()
  
  Dim OutApp As Object
  Dim OutMail As Object
  Dim strbody As String
  
  Dim rng As Range
  
  Dim x As Integer, y As Integer
  Dim total_Resource As Integer
  
  Application.ScreenUpdating = False
  
  ' Delete the Temp sheets, if any (just precautionary step)
  Application.DisplayAlerts = False
  On Error Resume Next
  Sheets("Temp").Delete
  Application.DisplayAlerts = True
  Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Temp"
  
  Sheets("Mail Details").Select
  Range("A5").Select
  Range(Selection, Selection.End(xlToRight)).Select
  Range(Selection, Selection.End(xlDown)).Select
  Selection.Copy
  Sheets("Temp").Select
  Range("A5").Select
  ActiveSheet.Paste
  Application.CutCopyMode = False
  
  Columns("J:J").EntireColumn.Delete
  Columns("A:A").EntireColumn.Delete
  Range("A5").Select
  Range(Selection, Selection.End(xlToRight)).Select
  Range(Selection, Selection.End(xlDown)).Select
  
  '' Below code not getting executed successfully
  'Selection.Select
  'Set rng = Sheets("Temp").Selection.SpecialCells(xlCellTypeVisible)
  'rng.Copy
  
  ' NEED HELP Here : TO send this selected TABLE within the email BODY to someone...
  
  ' code for sending the mails form Excel
  Sheets("Mail Details").Select
  Set OutApp = CreateObject("Outlook.Application")
  Set OutMail = OutApp.CreateItem(0)
  
  strbody = "Dear " &amp; Cells(x + 5, 3).Value &amp; ", " &amp; _
         vbNewLine &amp; vbNewLine &amp; _
         "Below Table provides the overall statue of Pending Lists." &amp; _
           vbNewLine &amp; vbNewLine &amp; vbNewLine &amp; _
        "Thank You " &amp; vbNewLine &amp; "XYZ..."
  
  On Error Resume Next
  With OutMail
      .To = Sheets("Mail Details").Range("D6").Value
      .CC = ""
      .BCC = ""
      .Subject = "Excel Table Attached"
      .Body = strbody
      .Send
  End With
  
  On Error GoTo 0
  Set OutMail = Nothing
  Set OutApp = Nothing
  
  MsgBox "Mails have been sent", vbDefaultButton1, "Mail Sent!!!"
  
  End Sub
  </code></pre>
  
  <p>Thanks in advance
  Kunal...</p>