title: How to email worksheet to yourself in Excel/VBA (change the email dynamically depending on outlook account open)
body: <p>Right now I have a workbook with some VBA that will email one user (email address is hard coded) when a button is pressed. It works great. However, I was wondering if it were possible to "cc" the email to the the user who is pressing the button to email. It could be from 10-15 different people.</p>
  
  <p>Right now the below code will email "orders@myemail.com" a copy of the sheet called "Print", and in the inbox it comes from the correct user. Somehow it is able to tap into the users email and send it automatically for them, so I'm thinking there must be a way for them to CC themselves too.</p>
  
  <p>All email accounts will be on Microsoft Oulook.</p>
  
  <p>Here is the code that emails one person (I got it from <a href="http://www.rondebruin.nl/win/s1/outlook/amail2.htm" rel="nofollow">http://www.rondebruin.nl/win/s1/outlook/amail2.htm</a>):</p>
  
  <pre><code>  'Sub that emails the 3rd sheet in the body of an email
      Sub Mail_Sheet_Outlook_Body()
      Call UnProtect
      Application.ReferenceStyle = xlA1
  
      'RangetoHTML function is copied in the module after this sub.
  
          Dim rng As Range
          Dim OutApp As Object
          Dim OutMail As Object
  
          With Application
              .EnableEvents = False
              .ScreenUpdating = False
          End With
  
          Set rng = Nothing
  
          Set rng = Sheets("Print").UsedRange
  
          Set OutApp = CreateObject("Outlook.Application")
          Set OutMail = OutApp.CreateItem(0)
  
          On Error Resume Next
  
              With OutMail
                  .To = "orders@myemail.com" 
                  .CC = ""                              
                  .BCC = ""
                  .Subject = "New Order from Employee"
                  .HTMLBody = RangetoHTML(rng)   
                  .Send   'or use .Display
               End With 
      On Error GoTo 0
  
      With Application
          .EnableEvents = True
          .ScreenUpdating = True
      End With
  
      Set OutMail = Nothing
      Set OutApp = Nothing
      Call Protect
      End Sub
  </code></pre>
  
  <p>So to reiterate what I'm asking, is there anyway that when user1@email.com sends in an order/sends an email, that it "cc"s it to himself, and when user2@email.com does the same thing it only cc's himself. Dynamically changes based on who's account has the workbook open.</p>