1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Send excel sheet ( email) through macro with recipient and cc

Discussion in 'Business Applications' started by Ryan_Bernal, Jan 3, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. Ryan_Bernal

    Ryan_Bernal Thread Starter

    Joined:
    Jan 3, 2013
    Messages:
    3
    I found this code in this forum.
    i want to add recipient as CC or BCC. What is the correct code for that?
    Thanks in advance!
    Code:
    Public Sub email()
    
    Dim SubJ, Recip As String
    
    SubJ = "Enter your suject"
    Recip = "[email protected]"
    
    
    ThisWorkbook.SendMail Recip, SubJ
    
    msgbox "Email Sent"
    
    End Sub
     
  2. 20_2_Many

    20_2_Many

    Joined:
    Jun 29, 2012
    Messages:
    518
    something like this may work for you - assuming you mean to send from Excel. Please do always include OS and Application system Versions, saves a great deal of time!
    .To and the rest draw the email address from specific cells, rather that hard coding it.
    You can use something like
    .To = ActiveSheet.Cells(1, 1) & ";" & ActiveSheet.Cells(1, 2) & ";" & ActiveSheet.Cells(1, 3)
    to add more.
    Excellent help here if you search for Excel Outlook vba

    Here is some sample code. Good Luck.
    Sub SendingSheet()

    Dim oMSOutlook As Object
    Dim oEmail As Object

    Set oMSOutlook = CreateObject("Outlook.Application")
    Set oEmail = oMSOutlook.CreateItem(olMailItem)

    With oEmail
    .To = ActiveSheet.Cells(1, 1)
    .CC = ActiveSheet.Cells(2, 1)
    .BCC = ActiveSheet.Cells(3, 1)
    .Send
    End With


    Set oMSOutlook = Nothing
    Set oEmail = Nothing

    End Sub
     
  3. Garf13LD

    Garf13LD

    Joined:
    Apr 17, 2012
    Messages:
    455
    As sendmail has limited feature, only way is to create a outlook object as 20_2_Many suggested.
     
  4. Ryan_Bernal

    Ryan_Bernal Thread Starter

    Joined:
    Jan 3, 2013
    Messages:
    3
    thank you for your help.
    I will try this as soon as i got home.
     
  5. Ryan_Bernal

    Ryan_Bernal Thread Starter

    Joined:
    Jan 3, 2013
    Messages:
    3
    thank you for your help.
    I will try this as soon as i got home.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1083518

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice