+ Reply to Thread
Results 1 to 8 of 8

Copy the subject line into the body of an email

  1. #1
    Registered User
    Join Date
    12-02-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    6

    Copy the subject line into the body of an email

    Hi everyone,

    This one looks easy but the internet does not have a solution, at least I cant find one :-).

    When typing a new mail I usually follow these steps:
    1. Click "New mail"
    2. Fill in the receiver
    3. Fill in the subject line then select the typed subject line and press control + C
    4. Start typing the body of the mail:

    Subject: control + V

    I was wondering if it would be possible to have a macro that copies the subject line text of my current mail into the body at cursors point.

    Anyone can help me out?
    Thanks in advance!
    Last edited by Aerdvark; 04-20-2020 at 09:05 AM. Reason: Typo's corrected

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,479

    Re: Copy the subject line into the body of an email

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Registered User
    Join Date
    12-02-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Copy the subject line into the body of an email

    Thanks Greg, your code works.
    This is, however, a different approach.
    I do understand it but not all my collegues would.

    There is no way to "read" what I have typed in the subject field?
    Then I would make a macro (shortkut key combination) that grabs the subject line's text..?

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,479

    Re: Copy the subject line into the body of an email

    Hi again,

    Ok, the following routine must be inserted into an OUTLOOK (not Excel) VBA CodeModule - see if it does what you need:

    Please Login or Register  to view this content.

    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M

  5. #5
    Registered User
    Join Date
    12-02-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Copy the subject line into the body of an email

    Hi Greg,

    Thanks again for the quick reply, really appreciated!

    It does work but is messes up my body text wich is inserted as template.
    (Any new mail I create opens up with a autograph, like Kind regards, with my name and number and company logo)
    Looks like the mail becomes plain text and no HTML, but it is only how it looks.
    In reality the mail stays HTML but the company logo is deleted.
    Also the subject is not inserted at cursors point but at the top of the mail.

    But, I am honest with you, I have no clue about this code.
    I can do some VBA put mainly excel orientated, this is new to me.



    Please Login or Register  to view this content.
    Maybe you have some time to explain me? But, don't feel obligated, if you have no time I can understand and will try to learn some more, that may help as well :-).

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,479

    Re: Copy the subject line into the body of an email

    Hi again,

    I'm not too familiar with the Outlook object model, so I really can't offer any further advice.

    You might find my comments useful in the following:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-02-2014
    Location
    Netherlands
    MS-Off Ver
    Excel 2013
    Posts
    6

    Re: Copy the subject line into the body of an email

    Hi Greg,

    Thanks for your time and efford.

    It really is so much different from the pieces of code I know in Excel VBA, there is not much I can easily understand.
    But your code got me thinking, it all goes wrong when this line comes in:

    Please Login or Register  to view this content.
    The .body causes the mail template to get messed up.

    So I googled for "vba outlook insert text at cursor" wich brought me to several functions but this piece of code gave me some insight:
    Please Login or Register  to view this content.
    Next I did some tests and this seems to be working.
    So how do I implement these 2 pieces of code. I came up with this, but obviously it does not work;

    Please Login or Register  to view this content.
    It is the red part what does not work, Iknow I use it wrong but have you got a clue how to write the code correct?

  8. #8
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2013
    Posts
    3,479

    Re: Copy the subject line into the body of an email

    Hi again,

    I'm not sure about inserting text at the current cursor position, but does the following code help to maintain your email template?

    Please Login or Register  to view this content.
    Regards,

    Greg M

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How To Replace One Line From Email Body With New Line
    By Upendra2016 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-13-2016, 04:01 AM
  2. Range not working in body line
    By Sam Hatch in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-26-2016, 11:11 AM
  3. Outlook 2013 Copy Body and Subject Line
    By wrasser in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 05-12-2015, 03:54 PM
  4. [SOLVED] Adding a 2nd line to body of outlook e-mail
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-22-2014, 11:48 AM
  5. Can't enter more than 1 line of text in body of email
    By moyay4 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2013, 01:41 PM
  6. Multi line email body from HYPERLINK CONCATENATE MAILTO?
    By JRR007 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-23-2012, 08:18 AM
  7. [SOLVED] Create macro to send worksheet as body of email using cells as subject line
    By LindaABH in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-16-2012, 07:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1