+ Reply to Thread
Results 1 to 8 of 8

Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

  1. #1
    Registered User
    Join Date
    08-08-2020
    Location
    Frankfurt
    MS-Off Ver
    2013
    Posts
    17

    Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    Dear Everyone,

    I am new to VBA and I would like to kindly ask you how to do the following coding: I want to say if the value on a specific cell is numeric error thus #NUM! then, I want to attach two specific tables as body on an outlook mail otherwise send a message "no changes". I do not need the full code for attachments etc. cause I have already written it. I only need a code for the if cell a1 is numeric error then attach the following dynamic range.

    Thanks in Advance!!!

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    to check if a cell has an error in it, more than likely this will work:
    Please Login or Register  to view this content.
    it also depends on how you want to attach the tables. you can manually copy and paste them into the email yourself and see what happens. that is different than, say, using the HTML language to display the data properly. outlook mail items have an HTMLbody property that has a purpose of taking in HTML code and showing it to a recipient as if they were looking at it on a webpage itself. so, for instance, if you wanted to display excel table (specified range) as an actual table inside an outlook mail item, it would be something like this (without all the spaces):
    Please Login or Register  to view this content.
    that code can also be consolidate using other VBA methods more than likely.

  3. #3
    Registered User
    Join Date
    08-08-2020
    Location
    Frankfurt
    MS-Off Ver
    2013
    Posts
    17

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    Indeed I am using the HTML property but I cannot paste my code here because it says that it includes outlook coding which is not accepted. Thank you for your feedback though!

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    post it on a could drive and them post the link here. furthermore, you can get around the security here like I did (placing spaces in code), but the admins probably don't like that.

    or, put the code in a text file and attach that. many ways....

  5. #5
    Registered User
    Join Date
    08-08-2020
    Location
    Frankfurt
    MS-Off Ver
    2013
    Posts
    17

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    Thank you. I attached again both the excel and the text file. Could you please help me? If there is no change in the dates before and after for the three different cases then the client, date before and date after will be denoted as : #NUM! which is alright! However, if there is no change I want to include an if formula in vba which will say something like the following multiple if formula: if cell c5, f5, i5 = #NUM! then I want in the body mail a message only saying : "There were no changes in delivery dates", otherwise if only one of these cells is = #NUM! then display in the body mail only the tables for the other two cases i.e. the client, the date before, and the date after.
    Thanks in advance,
    Attached Files Attached Files

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    well, first of all, the output as it was for me, with regard to HTMLbody, was, as in the attached file:

    I don't know if that's what you intended or not? furthermore, to add what you desire to that, I would guess you would just need this:
    Please Login or Register  to view this content.
    now, I've done most of the work for you. you can surely do the rest.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-08-2020
    Location
    Frankfurt
    MS-Off Ver
    2013
    Posts
    17

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    Thank you so much for you time and consideration. All the best!

  8. #8
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Send Email With Multiple Tables In Body Dynamic Ranges with if Statements

    I'm going to assume that you solved the issue then. if so, glad to help. =)

+ 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 insert multiple ranges from excel to body of email
    By Angie28 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2015, 07:18 PM
  2. [SOLVED] Trying to use multiple named ranges in the body of an automatically sent email from Excel
    By Jo2710 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2014, 12:01 AM
  3. How to send email from excel using VBA with Cell Range (Including Images) as Email Body
    By Novice_To_Excel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-24-2014, 05:06 AM
  4. [SOLVED] Excel can send mail with multiple cells info as email body and subject, befr 3 day of due
    By ExcelUser2707 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-19-2013, 06:49 AM
  5. [SOLVED] Excel can send mail with multiple cells info as email body and subject, befr 3 day of due
    By ExcelUser2707 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-13-2013, 04:29 AM
  6. Send New Email W/ Body of Received Email, Then Delete Sent Email
    By edneal2 in forum Outlook Formatting & Functions
    Replies: 2
    Last Post: 07-01-2013, 12:45 AM
  7. Replies: 5
    Last Post: 12-17-2012, 05:10 PM

Tags for this Thread

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