View Single Post
 
Old 09-05-2014, 06:45 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'm sure there has to be a way of pasting a Word table into an Outlook message programmatically, but I've never used Outlook. That said, the following will output a table's data in tabular format as part of the email body:

Code:
Dim r As Long, c As Long, Rng As Range, StrMsg As String
With EmailItem
  .BodyFormat = olFormatHTML
  .Subject = "Disposition of AIDC Destructive Tests"
   StrMsg = "Email Information" & vbCrLf & vbCrLf
  With Doc.Tables(1).Range
    For r = 1 To .Rows.Count
      For c = 1 To .Columns.Count
        Set Rng = .Rows(r).Cells(c).Range
        Rng.End = Rng.End - 1
        StrMsg = StrMsg & Rng.Text
        If c < .Columns.Count Then
          StrMsg = StrMsg & vbTab
        Else
          StrMsg = StrMsg & vbCr
        End If
      Next
    Next
  End With
  .Body = StrMsg
  .To = "Addresses Contained in the Word Document"
  .Importance = olImportanceNormal
  .Attachments.Add Doc.FullName
End With
Do note that the above will not work with a table having merged/split cells.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote