Removing self from CC in email generated from Excel.

Mr Rice

New Member
Joined
Nov 30, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

i have a multiple people using a copy of the same workbook. copy 1, copy 2, etc.

the issue i am having is i need to remove myself or anyone in this list that is using the sheet from the CC


VBA Code:
Set whoswho = Worksheets("Customer Service Reps").Range("whoswho") ' whoswho is located at ='Customer Service Reps'!$G$2:$I$6,'Customer Service Reps'!$L$2:$L$6
With whoswho
For i = 2 To .Rows.Count
    If Not Environ("UserName") = Sheets("Customer Service Reps").Cells(i, 12) Then
        usernames = usernames & ", " & Sheets("Customer Service Reps").Cells(i, 12) 
        sTo = sTo & "; " & Sheets("Customer Service Reps").Cells(i, 9)
    End If
Next
End With

VBA Code:
With WS
.Range("D2:D" & LR).Select

For Each r In Selection
For i = 2 To LR3
CSR1 = Range("K" & r.Row)
S1 = Range("L" & r.Row)
S2 = Range("F1").Value & ":" & Range("F" & r.Row)
S3 = Range("G1").Value & ":" & Range("G" & r.Row)
B1 = Range("C1").Value & ":" & Range("C" & r.Row)

        If S1 = "SPLIT ORDER" Then
            B2 = "<b>Stock Out:</b>" & "<p>Line: " & _
             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESD:&nbsp;&nbsp;&nbsp&nbsp;Part #:" & _
             "<p>" & "<b>ORDER GOOD:</b>" & "</p>"
        ElseIf S1 = "STOCK OUT" Then
            B2 = "<b>Stock Out:</b>" & "<p>Line: " & _
             "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESD:&nbsp;&nbsp;&nbsp&nbsp;Part #:" & _
             "<p>"
        ElseIf S1 = "BACKORDER TO RELEASE" Then
            B2 = "<b>BACKORDER TO RELEASE</b>" & "<p>" & _
            "</p>"
            Else: B2 = ""
        End If
    Next

Dim mApp As Outlook.Application
Set mApp = New Outlook.Application
Dim mMail As Outlook.MailItem
Set mMail = mApp.Createitem(mMailItem)
Set mApp = CreateObject("Outlook.Application")
Set mMail = mApp.Createitem(0)
On Error Resume Next
With mMail
.display
End With
With mMail
.To = LCase(CSR1)
.CC = LCase(sTo) & "; " & "cs@something.net"

.Subject = S1 & " " & S2 & " " & S3
          
.HTMLBody = vbclf & B2 & WMBody & vbclf
End If
End With 'mMail
Next r   'mail's to and cc
End With ' worksheet

Set OutMail = Nothing
Set OutApp = Nothing

on my PC it works, on the other employees it does not work.

can someone tell me what i'm doing wrong here?

let me know if you need additional information, thank you in advance!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top