+ Reply to Thread
Results 1 to 13 of 13

Need to add CC field to the Code

  1. #1
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Need to add CC field to the Code

    Hey Guys,

    I am using the below code to run the macro to send out emails using outlook.

    Could you please help in amending it and adding few lines of code to include a CC field as well ( where we can add emails Id to be CCed)? Right now, I put email Id for "To" part in one column and i want to add CC email IDs in a separate column.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need to add CC field to the Code

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Sorry. This doesn't work. For CC, need to capture values from excel tab and it will not be one email ID that will be CCed. "CC" Will be different for each email. Is there a way to include this in the code?

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,562

    Re: Need to add CC field to the Code


  5. #5
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Yup. But this doesn't specifically answer the question of including CC in the code Please help

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Need to add CC field to the Code

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Thank you. I tried after including this line, but i am getting type mismatch error. I am sure i am missing something. Could you please help.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Need to add CC field to the Code

    Offset requires numbers.

    You examine cells in Column B so cell.Offset(, 1) for Column C value , cell.Offset(, 2) for Column D value and so on.....

  9. #9
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Sorry.. i realized this mistake after posting comment. I did change that to column no. and now i get error at below line and getting error " Outlook doesn't recognize one or more name"

    Code stops at this line.

    Please Login or Register  to view this content.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,914

    Re: Need to add CC field to the Code

    Works fine for me.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Sorry.. my file currently picks Email Id for "To" Part of email from column B and Column D till Z are reserved for attachments. So situation is that column B will be populated with email ids ( which will be different in each row) which should be kept in "To" part of email and i want Column C ( which again will include different email ids for each row) to include email ids which should be CCed for each email. Hence, the code need to be amended to accommodate the column C part only.

    code which you just posted works for one specific email for To and CC. Could you please help in updating the code to accommodate this requirement. Really appreciate all the efforts.

  12. #12
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need to add CC field to the Code

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    04-23-2020
    Location
    Canada
    MS-Off Ver
    MS Office 365 ProPlus
    Posts
    32

    Re: Need to add CC field to the Code

    Thank you Thank you Thank you! This works absolutely fine.

+ 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. [SOLVED] Display a code based on if there is value in a field
    By new2xcel in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 08-30-2021, 04:29 PM
  2. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  3. [SOLVED] PowerPivot: Merge Month Field and Year Field Into a Date Field
    By mo4391 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-17-2015, 11:59 AM
  4. VBA: Reset Field Code
    By pravin.neel in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2012, 08:01 AM
  5. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  6. Replies: 3
    Last Post: 03-03-2012, 12:16 PM
  7. [SOLVED] Code to unfilter one field only
    By scrabtree23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2005, 12:10 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