StartDownloadsServiceSamplesWorkshopsContact DeutschEnglish
 
Samples
General
Outlook®
 
Awarded by
Microsoft since 2005:
mvp logo
VBOffice Info
Visitors1778649
Impressions6668805
Links
Imprint
Privacy Policy
Contact
E-Mail: Insert formatted Excel table
Author: Michael BauerHomepage
Date: 29.01.2007Accessed: 32820
  
Description

By using Word as e-mail editor you get access to Word's powerful object model even for e-mails. With that it's possible to insert a formatted Excel table into an Html e-mail.

This sample assumes that the e-mail and workbook are already opened and copies the range from B2 to C6 into the e-mail - inclusive all its formattings.

Via Tools/References, please add the Word and Excel libraries to your Outlook VBA project.

Sub CopyFromExcelIntoEMail()
  Dim Doc As Word.Document
  Dim wdRn As Word.Range
  Dim Xl As Excel.Application
  Dim Ws As Excel.Worksheet
  Dim xlRn As Excel.Range

  Set Doc = Application.ActiveInspector.WordEditor
  Set wdRn = Doc.Range

  Set Xl = GetObject(, "Excel.Application")
  Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)

  Set xlRn = Ws.Range("b2", "c6")
  xlRn.Copy

  wdRn.Paste
End Sub
 
 

ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the ... [more]

 

Access the master category list in the blink of an eye, share your categories in a network, get a reminder service, and ... [more]

 

SAM automatically sets the sender, signature, and folder for sent items, for instance based on the recipient ... [more]

 

OLKeeper reliably prevents users from closing their Outlook window and thus possibly missing reminders or ... [more]