Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
667
Office Version
  1. 365
Platform
  1. Windows
hi,

Does any know how to add the subject line into email body, rather than copy & paste into ?

Hoping someone can 'rescue me' & thank you for your help.


KR
Trevor3007
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
In that case, you're going to have to provide much more information than you have so far. For example, where does the subject line come from? And what about any other content - message body, email address, etc.?
 
Upvote 0
In that case, you're going to have to provide much more information than you have so far. For example, where does the subject line come from? And what about any other content - message body, email address, etc.?


Hi & thanks for your reply.


The only thing I need is the subject line IE today is Saturday 11/11/17 to show in the body of the email. I would send a screenshot but I don't know how to & there is no 'paste' option on the forum.

KR
Trevor3007
 
Upvote 0
So all you want is a macro that will insert the email subject somewhere in the email body? Since you're going to have to run the macro manually, it's not going to save much time/effort, unless you go to the extra effort of creating a button for the macro and assign the macro to it on the QAT. That's a lot of effort for minimal time savings.
 
Upvote 0
So all you want is a macro that will insert the email subject somewhere in the email body? Since you're going to have to run the macro manually, it's not going to save much time/effort, unless you go to the extra effort of creating a button for the macro and assign the macro to it on the QAT. That's a lot of effort for minimal time savings.


hiya,

Yes I appreciate that but for me its worth the bother/effort. And yes I would assign a 'button'.

Kindest regards
Trevor3007
 
Upvote 0
Try:
Code:
Sub InsertHeaderText()
'Note: This code requires references to Word, via Tools|References
Dim olMail As Outlook.MailItem, olInsp As Outlook.Inspector, wdDoc As Word.Document
Set olMail = Application.ActiveInspector.CurrentItem
Set olInsp = olMail.GetInspector
Set wdDoc = olInsp.WordEditor
Word.Selection.InsertBefore " " & olMail.Subject
Set wdDoc = Nothing: Set olInsp = Nothing: Set olMail = Nothing
End Sub
 
Last edited:
Upvote 0
Try:
Code:
Sub InsertHeaderText()
'Note: This code requires references to Word, via Tools|References
Dim olMail As Outlook.MailItem, olInsp As Outlook.Inspector, wdDoc As Word.Document
Set olMail = Application.ActiveInspector.CurrentItem
Set olInsp = olMail.GetInspector
Set wdDoc = olInsp.WordEditor
Word.Selection.InsertBefore " " & olMail.Subject
Set wdDoc = Nothing: Set olInsp = Nothing: Set olMail = Nothing
End Sub


hiya :}

Thanks for getting back so quickly.

Run your code but debug error and this was highlighted wdDoc As Word.Document ( I coloured the text red so it would standout more)

Sub InsertHeaderText()
'Note: This code requires references to Word, via Tools|References
Dim olMail As Outlook.MailItem, olInsp As Outlook.Inspector, wdDoc As Word.Document
Set olMail = Application.ActiveInspector.CurrentItem
Set olInsp = olMail.GetInspector
Set wdDoc = olInsp.WordEditor
Word.Selection.InsertBefore " " & olMail.Subject
Set wdDoc = Nothing: Set olInsp = Nothing: Set olMail = Nothing
End Sub


KR
Trevor3007
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,186
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top