• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

E mail macro to include text from specific cell in message

bnpdkh

Member
hello, I have been using a macro to send email automatically with a standard message entered in Dim strbody As String. Is there a way to insert the text contained in a specific cell into the message. For example cell D35 of work week autoload.xls will contain the text "Work Week 27". I would like to insert this text into the strbody after "T-17 work information (D:35) " and then the rest of the message. Any ideas would be greatly appreciated

Code:
 Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
    Dim SigString As String
    Dim Signature As String
 
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
 
    strbody = "<H3><B>All;</B></H3>" & _
              "T-17 work information has now been loaded into appropriate work week schedules, please review and provide feedback as required.<br>" & _
              "Please contact Corry Lynne DeBruyn if you have any questions.<br>" & _
              "<br><br><B>Thank you</B>"
 
What about something like:

Code:
Dim All As String
Dim Body1 As String
Dim Body2 As String

All = Cells(1, 2)
Body1 = Workbooks("Autoload.xlsx").Worksheet("Sheet1").Range("D35").Text
Body2 = Cells(1, 4)
strbody = "<H3><B>" & All & ";</B></H3> " & _
  "T-17 work information" & Body1 & _
  "<br>" & Body2 & _
  "<br>" & "<br><br><B>Thank you</B>"
 
Back
Top