+ Reply to Thread
Results 1 to 6 of 6

Can I use Excel cell reference to populate e-mail text?

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Can I use Excel cell reference to populate e-mail text?

    I know that isn't worded correctly....but my goal is to use an Excel spreadsheet value to complete parts of an e-mail body.

    Example: Excel spreadsheet cell A1 value is 8%. Instead of typing in Outlook each month saying "Sales were up 8%" I would like to say "Sales were up [A1]". I report summarized numbers monthly in email commentary and there are several metrics that would be great to link each month.

    Any help is greatly appreciated! Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    896

    Re: Can I use Excel cell reference to populate e-mail text?

    It is doable, just setup your macro to use that field as the portion of the text you want

    Please Login or Register  to view this content.

    You would need a ref to your cell
    Dim xxxx As Range

    Set the value to a variable and then you can use it in your email code
    Set xxxx = ThisWorkbook.Worksheets("Sheet1").Range("A1")
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  3. #3
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Re: Can I use Excel cell reference to populate e-mail text?

    Thanks for the prompt response! However I can't get it to work. I have it saved in a Macro-Enabled workbook but when I click run nothing happens. I changed the default e-mail address to mine, I even cleared the xxxx section completely to see if I can just get the text to generate as an email, but it didn't function when I clicked run.
    Attached Files Attached Files
    Last edited by brendangroff; 07-07-2021 at 11:52 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    896

    Re: Can I use Excel cell reference to populate e-mail text?

    Can you debug that macro and put a break point right below this line and see what the value is for your range value?

    Maybe this line needs to be updated to this
    Set xxxx = ThisWorkbook.Worksheets("Sheet1").Range("A1")

    update to this:
    Set xxxx = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value

  5. #5
    Registered User
    Join Date
    04-14-2014
    Location
    Pennsylvania
    MS-Off Ver
    Excel 2019 (PC) Version 1808
    Posts
    46

    Re: Can I use Excel cell reference to populate e-mail text?

    Yes, still no luck unfortunately. I attached the spreadsheet to my earlier response

  6. #6
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    896

    Re: Can I use Excel cell reference to populate e-mail text?

    YEP!! that was the problem. Add the .Value to the line where you are calling your range.

    strBody = "Sales were up " & ThisWorkbook.Worksheets("Sheet1").Range("A1").Value

    Also make sure to point to the correct cell your file has A2, but the value is in A1

+ 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. VBA to e-Mail with excel cell reference data as email body
    By Vcare in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-01-2018, 09:55 AM
  2. VBA - Search Sheet 1 for text, reference corresponding cell, populate Sheet 2?
    By rdr06001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2016, 01:30 PM
  3. Replies: 1
    Last Post: 02-11-2015, 01:56 PM
  4. [SOLVED] screenshot text file and embed in outlook mail through excel with mail info
    By bmbalamurali in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 01-11-2015, 08:21 PM
  5. Replies: 0
    Last Post: 01-31-2013, 06:15 AM
  6. Replies: 1
    Last Post: 07-22-2012, 09:26 AM
  7. How to e-mail selected row and use e-mail address in a cell to send e-mail from excel
    By syedalamgir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2010, 02:15 AM

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