How to Quickly Copy the Outline of a Word Document to Your Outlook Email

If you want to send the outline of a Word document instead of the entire document via email, you can refer to this article. Here we’ll teach you how to quickly copy the outline of a document and insert it into an email.

Sometimes you may need to copy the outline of a Word document to an Outlook email for some reasons, such as you want to make use of the outline to compose an email. In this case, it is unadvisable to manually copy and paste the headings. Instead, you can use the following way to achieve it with ease.

Quickly Copy the Outline of a Word Document to an Outlook Email

Copy the Outline of a Word Document to an Outlook Email

  1. For a start, open the source Word document in MS Word application.
  2. Then, press “Alt + F11” key button to access word VBA editor.
  3. Next, in the “Microsoft Visual Basic for Applications” window, copy and paste the VBA code below into a module.
Sub CopyHeadingsIntoOutlookMail()
    Dim objOutlookApp, objMail As Object
    Dim objMailDocument As Word.Document
    Dim objMailRange As Word.Range
    Dim varHeadings As Variant
    Dim i As Long
    Dim strText As String
    Dim nLongDiff As Integer

    'Create a new Outlook email
    Set objOutlookApp = CreateObject("Outlook.Application")
    Set objMail = objOutlookApp.CreateItem(olMailItem)
    objMail.Display
    Set objMailDocument = objMail.GetInspector.WordEditor
    Set objMailRange = objMailDocument.Range(0, 0)
 
    'Get the headings of the current Word document
    varHeadings = ActiveDocument.GetCrossReferenceItems(wdRefTypeHeading)

    For i = LBound(varHeadings) To UBound(varHeadings)
        strText = Trim(varHeadings(i))
 
        'Get the heading level
        nLongDiff = Len(RTrim$(CStr(varHeadings(i)))) - Len(Trim(CStr(varHeadings(i))))
        nHeadingLevel = (nLongDiff / 2) + 1
 
        'Insert the heading into the Outlook mail
        With objMailRange
             .InsertAfter strText & vbNewLine
             .Style = "Heading " & nHeadingLevel
             .Collapse wdCollapseEnd
        End With
    Next i
End Sub

VBA Code - Copy the Outline of a Word Document to an Outlook Email

  1. After that, you can run this macro simply via “F5” key button.
  2. Subsequently, an email will display with a message, shown as the screenshot below:Select "Allow"
  3. As long as you click “Allow” button, you will see that the outline of the source Word document have been copied into this email.Copied Outline in Email

Keep Tabs on Outlook Data Protection

Outlook is vulnerable to various factors, such as viruses, malware, software faults and hardware issues and so on. Therefore it’s essential to keep all the risks at bay to protect your Outlook data effectively. Moreover, you should make regular data backups for your Outlook. Last but not least, you have to get hold of a robust PST fix tool, like DataNumen Outlook Repair, which is able to recover PST data from damaged Outlook file like a cork.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged mdf and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.