Prompt to prefix subject line whenever sending an email

Delmar

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
Hello,

I copied the following code from another purpose, and tweaked it so that it always asks me if I want to prefix the Subject line, whenever I send an email. It works lovely, except I don't know how to get rid of the feature that sends a bcc email to me@domain.com.

I'm sure someone can tell me how to remove that feature.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
strBcc = "me@domain.com"
res = MsgBox("Prefix Subject Line?", vbYesNo + vbDefaultButton1, _
"BCC Message")
If res = vbNo Then
Cancel = False
Else
Dim strTemp As String
Dim strFilenum As Variant
strFilenum = InputBox("Enter Prefix to Subject Line?")
If strFilenum = "" Then
Cancel = True
MsgBox "The file number was blank or you clicked Cancel." _
& vbCrLf & "click Send and select No if you don't want to BCC & add a file number."
Exit Sub

Else
strTemp = "[" & strFilenum & "] " & Item.Subject
Item.Subject = strTemp
Item.Save
End If

Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Please check the BCC Script configuration. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could not resolve BCC")
If res = vbNo Then
Cancel = True
End If
End If
End If
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
This might do it -

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer

On Error Resume Next

Dim strTemp As String
Dim strFilenum As Variant
strFilenum = InputBox("Enter Prefix to Subject Line?")
If strFilenum = "" Then
Cancel = True
MsgBox "The file number was blank or you clicked Cancel." _
& vbCrLf & "click Send and select No if you don't want to BCC & add a file number."
Exit Sub

Else
strTemp = "[" & strFilenum & "] " & Item.Subject
Item.Subject = strTemp
Item.Save
End If

End Sub
 

Delmar

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
You are so helpful, Diane! Perfect. I wanted to offer this to other people in the company, but I didn't want to have to always create some email rule to delete the NDR that I got back every time from this Bcc address. Works perfect. Thanks!
 

Delmar

New Member
Outlook version
Outlook 365 64 bit
Email Account
Office 365 Exchange
Diane, thanks for the above, but I just realized that this code doesn't ask me anymore whether or not I want to add a prefix. The previous code used to ask me if I wanted to or not, and I could click NO and then it would go through. Can I have that back?
 
Similar threads
Thread starter Title Forum Replies Date
Paul Hobbs Automatically accept "Empty Folders" prompt Outlook VBA and Custom Forms 6
C VBA to prompt for Sent folder destination Outlook VBA and Custom Forms 3
Q Prompt button to auto turn on Out of Office Outlook VBA and Custom Forms 3
R Prompt asking the user to send email to folder as *.msg file Outlook VBA and Custom Forms 1
R Make Enter Network Password Prompt Go Away Automatically Using Outlook 0
K VBA to prompt and send a CC Outlook VBA and Custom Forms 6
K VBA - Prompt for reminder date time Outlook VBA and Custom Forms 7
S Have Rule or Quick Step PROMPT for custom FLAG Due/Reminder date Outlook VBA and Custom Forms 3
P Constant Username Password Prompt Using Outlook 2
A Prompt on exit to empty deleted items folder "for all accounts" does not work? Using Outlook 6
C Is there a way to prompt a user before deleting an item? BCM (Business Contact Manager) 4
S Prompt to add for text to existing subject line before sending. Using Outlook 9
S Trying to have a prompt to ask for text to be added to subject before sending. Using Outlook 3
N Prompt for password when sending an email Exchange Server Administration 1
O How to turn off the prompt to permanently delete messages upon exiting? Using Outlook 2
M Email Prompt Outlook VBA and Custom Forms 1
T Prompt for email account Outlook VBA and Custom Forms 1
P Outlook security prompt after installing Add-in Outlook VBA and Custom Forms 3
Q Otlk 2007 does not block when in "always prompt for..." mode Outlook VBA and Custom Forms 2
Q sending mail when Otlook in 'always prompt for user name and passw Outlook VBA and Custom Forms 4
2 How to get rid of the "Emailing:" prefix in the subject line Using Outlook 1
witzker Outlook 2019 Pls. add a Prefix for OUTLOOK 2019 here Using Outlook 1
B Add Prefix text to Subject Line Using Outlook 1
I No prefix + in the contacts Using Outlook 0
O "Int-" prefix added to sender's address Using Outlook 4
S Outlook 2003 Prefix on reply and forward Using Outlook 1
ill13 Prepend the user's computer name to the subject. Outlook VBA and Custom Forms 1
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 17
S Outlook Macro for [Date][Subject] Using Outlook 1
O How to find and replace a word in Outlook-Agenda-Subject and Message? Using Outlook 0
D ISOmacro to extract active mail senders name and email, CC, Subject line, and filename of attachments and import them into premade excel spread sheet Outlook VBA and Custom Forms 2
C Outlook 365 Subject Prefixes? Outlook VBA and Custom Forms 1
A Macro to file emails into subfolder based on subject line Outlook VBA and Custom Forms 1
N Save selected messages VBA does not save replies and/or messages that contain : in subject Outlook VBA and Custom Forms 1
V vBA for searching a cell's contents in Outlook and retrieving the subject line Outlook VBA and Custom Forms 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
M Outlook 2013 Script Assistance - Save Opened Link with Subject Added Outlook VBA and Custom Forms 1
C How to rename subject line and forward the email Outlook VBA and Custom Forms 2
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 16
M Outlook 2013 Replace Subject with Conversation (a "hidden" value). Outlook VBA and Custom Forms 0
M Convert Subject Line to Internet Header version of Subject Outlook VBA and Custom Forms 10
M Adding Subject to this Link-Saving VBA Outlook VBA and Custom Forms 5
P Auto Insert Current Date or Time into Email Subject Outlook VBA and Custom Forms 2
M VBA to auto forward message with new subject and body text Outlook VBA and Custom Forms 8
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
B Remove Subject Residual Outlook VBA and Custom Forms 3
F VBA to ensure a code is entered in Subject title Outlook VBA and Custom Forms 1

Similar threads

Top