---
description: Some users wish Outlook to auto take the first line of the email body as the subject when sending an email which has no subject. Now, in this article, we will introduce a method to realize it via VBA code.
title: How to Auto Take the First Line of Body as Subject before Sending an Outlook Email without Subject
image: https://www.datanumen.com/blogs/wp-content/uploads/2018/04/vba-code-auto-use-first-line-body-as-subject.jpg
---

-
-
-

[Home](https://www.datanumen.com/blogs/) > [Solutions](https://www.datanumen.com/blogs/category/solutions/) > [Office Solutions](https://www.datanumen.com/blogs/category/solutions/office-solutions/) > [Outlook Solutions](https://www.datanumen.com/blogs/category/solutions/office-solutions/outlook-solutions/) > How to Auto Take the First Line of Body as Subject before Sending an Outlook Email without Subject

# How to Auto Take the First Line of Body as Subject before Sending an Outlook Email without Subject

[Outlook Solutions](https://www.datanumen.com/blogs/category/solutions/office-solutions/outlook-solutions/) September 29, 2025

Share Now:

-
-
-
-
-
-
-
-

*Some users wish Outlook to auto take the first line of the email body as the subject when sending an email which has no subject. Now, in this article, we will introduce a method to realize it via VBA code.*

Multiple users frequently forget to input subject when composing and sending an email. Thus, usually, they hope that Outlook can automatically fill the subject by the first line of the email body if the outgoing email has no subject. Thereinafter, we will share an easy and handy method with you.

## Auto Take the First Line of Body as Subject before Sending an Email without Subject

1. At the very outset, launch Outlook application.
2. Then, by following the steps in “ [How to Run VBA Code in Your Outlook](https://www.datanumen.com/blogs/run-vba-code-outlook/)“, you can get into VBA editor.
3. Next, in the VBA editor, add the reference to “MS Word Object Library” with accordance to “ [How to Add an Object Library Reference in VBA](https://www.datanumen.com/blogs/add-object-library-reference-vba/)“.
4. Later, copy the code below into “ThisOutlookSession” project.

```
Private WithEvents objInspectors As Outlook.Inspectors

Private Sub Application_Startup()
    Set objInspectors = Outlook.Application.Inspectors
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If Inspector.CurrentItem.Class = olMail And Inspector.CurrentItem.Subject = "" Then
       Inspector.CurrentItem.Subject = " "
    End If
End Sub

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objMailSelection As Word.Selection
 
    If TypeOf Item Is MailItem Then
       Set objMail = Item
 
       If Len(Trim(objMail.Subject)) = 0 Then
          If MsgBox("No subject! Whether to take first line as subject?", vbQuestion + vbYesNo) = vbYes Then
             Set objMailDocument = objMail.GetInspector.WordEditor
             Set objMailSelection = objMailDocument.Application.Selection
 
             objMailDocument.Range(0, 0).Select
             objMailSelection.MoveEnd wdLine
 
             'Take first line of body as subject
             objMail.Subject = objMailSelection.Text
          End If
       End If
     End If
End Sub
```

![VBA Code - Auto Take the First Line of Body as Subject before Sending an Email without Subject]( "VBA Code - Auto Take the First Line of Body as Subject before Sending an Email without Subject")

5. After that, put cursor into “Application\_Startup” subroutine and press “F5”.
6. Finally, you can have a try.

- At first, create and compose an email with only subject empty.
- Then, click “Send” button.
- Later, you’ll get a message asking if to take first line of body as subject.![Message Asking If to Take First Line of Body as Subject]( "Message Asking If to Take First Line of Body as Subject")
- As long as you select “Yes” button, the first line of the email body will be extracted and used as subject and the email will be sent out.![First Line of Body Are Used as Subject]( "First Line of Body Are Used as Subject")

## Keep Your Outlook Data Safe

Absolutely, there are multiple significant emails and other items in your Outlook. Thus, you must be unwilling to come across Outlook data loss. Then, you have to take some actions, such as making regular data backups of your Outlook, learning to use the inbuilt repair tool to [fix Outlook](https://www.datanumen.com/outlook-repair/) errors and preparing a robust external recovery utility. DataNumen Outlook Repair is a good choice due to its high PST recovery rate.

## Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including [sql recovery](https://www.datanumen.com/sql-recovery/) and outlook repair software products. For more information visit [www.datanumen.com](https://www.datanumen.com/)

Share Now:

-
-
-
-
-
-
-
-

[← Previous post](https://www.datanumen.com/blogs/a-quick-insight-into-physical-shock-damage-on-hard-disk-drive-hdd/)

[Next post →](https://www.datanumen.com/blogs/5-reasons-solutions-when-usb-flash-drive-keeps-disconnecting-and-reconnecting-in-windows/)

Comments are closed.

![Data Recovery Blog]()

Follow or like us on Facebook, LinkedIn and Twitter to get all promotions, latest news and updates on our products and company.

-
-
-

### Featured Products

- [DataNumen Outlook Repair](https://www.datanumen.com/outlook-repair/)
- [DataNumen SQL Recovery](https://www.datanumen.com/sql-recovery/)
- [DataNumen Exchange Recovery](https://www.datanumen.com/exchange-recovery/)
- [DataNumen Access Repair](https://www.datanumen.com/access-repair/)
- [DataNumen Excel Repair](https://www.datanumen.com/excel-repair/)
- [DataNumen PDF Repair](https://www.datanumen.com/pdf-repair/)
- [DataNumen Word Repair](https://www.datanumen.com/word-repair/)
- [DataNumen Zip Repair](https://www.datanumen.com/zip-repair/)

### Popular posts

```json
{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#article","isPartOf":{"@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/"},"author":{"name":"AuthorCCW","@id":"https:\/\/www.datanumen.com\/blogs\/#\/schema\/person\/33ded6c47c77587f9158d99f05e23957"},"headline":"How to Auto Take the First Line of Body as Subject before Sending an Outlook Email without Subject","datePublished":"2018-04-27T03:22:41+00:00","dateModified":"2025-09-29T05:54:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/"},"wordCount":371,"commentCount":0,"publisher":{"@id":"https:\/\/www.datanumen.com\/blogs\/#organization"},"image":{"@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2018\/04\/vba-code-auto-use-first-line-body-as-subject.jpg","articleSection":["Outlook Solutions"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/","url":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/","name":"How to Auto Take the First Line of Body as Subject before Sending an Outlook Email without Subject","isPartOf":{"@id":"https:\/\/www.datanumen.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#primaryimage"},"image":{"@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2018\/04\/vba-code-auto-use-first-line-body-as-subject.jpg","datePublished":"2018-04-27T03:22:41+00:00","dateModified":"2025-09-29T05:54:53+00:00","description":"Some users wish Outlook to auto take the first line of the email body as the subject when sending an email which has no subject. Now, in this article, we will introduce a method to realize it via VBA code.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanumen.com\/blogs\/how-to-auto-take-the-first-line-of-body-as-subject-before-sending-an-outlook-email-without-subject\/#primaryimage","url":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2018\/04\/vba-code-auto-use-first-line-body-as-subject.jpg","contentUrl":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2018\/04\/vba-code-auto-use-first-line-body-as-subject.jpg","width":934,"height":492,"caption":"VBA Code - Auto Take the First Line of Body as Subject before Sending an Email without Subject"},{"@type":"WebSite","@id":"https:\/\/www.datanumen.com\/blogs\/#website","url":"https:\/\/www.datanumen.com\/blogs\/","name":"Data Recovery Blog","description":"Discuss every aspect of data recovery","publisher":{"@id":"https:\/\/www.datanumen.com\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanumen.com\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanumen.com\/blogs\/#organization","name":"Data Recovery Blog","url":"https:\/\/www.datanumen.com\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanumen.com\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2019\/02\/logowithouttext.jpg","contentUrl":"https:\/\/www.datanumen.com\/blogs\/wp-content\/uploads\/2019\/02\/logowithouttext.jpg","width":296,"height":397,"caption":"Data Recovery Blog"},"image":{"@id":"https:\/\/www.datanumen.com\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataNumen","https:\/\/x.com\/DataNumen","http:\/\/www.linkedin.com\/company\/datanumen","https:\/\/myspace.com\/datanumen\/","http:\/\/www.pinterest.com\/datanumen\/","https:\/\/www.youtube.com\/channel\/UCVIIuuKfUBHSJauUaVP13tw"]},{"@type":"Person","@id":"https:\/\/www.datanumen.com\/blogs\/#\/schema\/person\/33ded6c47c77587f9158d99f05e23957","name":"AuthorCCW","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3516ed90fc242780d3947a989f895bc46e70c3e83485d30f2b457a007906aa58?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3516ed90fc242780d3947a989f895bc46e70c3e83485d30f2b457a007906aa58?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3516ed90fc242780d3947a989f895bc46e70c3e83485d30f2b457a007906aa58?s=96&d=mm&r=g","caption":"AuthorCCW"},"sameAs":["https:\/\/www.datanumen.com\/"]}]}
```
