Forum Discussion

Ange-M_1973's avatar
Ange-M_1973
Copper Contributor
Jan 15, 2023

VBA Email for Excel - insert cell information into subject line

I am using the VBA code set out in the following site:

https://www.simplilearn.com/tutorials/excel-tutorial/send-email-in-excel

I have not included any of the CC/BCC or attachment options. The email contact is the same at all times the email is generated.

I have set the code to action the email on selection of a button.

The issue I have is that it does not cross reference what of row of data the selection was from.

 

What I would like is to take the name from column A and insert this into the subject line of the email?

I understand that this can be completed manually, but my preference is for full automation.

Any help would be appreciated.

9 Replies

  • Ange-M_1973 

    Change the line

    NewEmailItem.Subject = "Test Email Demo”

    to

    NewEmailItem.Subject = "Message for " & Range("A" & ActiveCell.Row).Value

    or something similar.

    • Ange-M_1973's avatar
      Ange-M_1973
      Copper Contributor
      Hi Hans
      thanks for your help, but I am still having trouble with this, as the adjustments did not work.

      Cheers

      Ang
    • Ange-M_1973's avatar
      Ange-M_1973
      Copper Contributor
      Thanks Hans
      I appreciate this, as I have no experience in writing VBA at all, and normally use what I find on the web to help me.
      I will test this out.

      Cheers

      Ang

Resources