Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 09-05-2014, 06:45 AM
macropod's Avatar
macropod macropod is offline Prefilled email with information contained in a Word document Windows 7 64bit Prefilled email with information contained in a Word document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,518
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Prefilled email with information contained in a Word document Word VBA - Save file as a string contained within the word (always same row and leng) RG87 Word VBA 1 05-21-2014 05:39 AM
Word delete page if string is not contained wolfking333 Word VBA 0 06-23-2013 10:02 AM
Prefilled email with information contained in a Word document Repeating Information in Word Document without Forms or VBA? Bill Bisco Word 6 09-03-2012 07:59 PM
How to disable email information in top of email snahtter Outlook 0 05-05-2012 03:57 AM
Merging a Word doc with VB functions contained adamwbrown Word 0 08-13-2008 06:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft