anton1992
06-18-2018, 04:23 PM
Hi,
I have the below code to prompt a user if an email about to be sent is to be tracked or not.
if selected to be tracked the prefix *OPO * is added into the front end of the subject box, there is a little proportion of coding at the end of the sub to remove duplicate prefixes when forwarding etc.
I'm completely stuck as to how to get the selection of option button one that drives the prefix to also automate the input of an email address into the CC field. If option button two is selected no email is to be entered.
Current coding I've figured out is below and is held in ThisOutlookSession, any help appreciated.
Thanks,
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim frm As UserForm1
Dim chosenvalue As String
Set frm = New UserForm1
frm.Show vbModal
Select Case True
Case frm.OptionButton1.Value
chosenvalue = "*OPO* "
Case frm.OptionButton2.Value
chosenvalue = ""
Case Else
MsgBox "You did not select a value, Cancelling send."
Cancel = True
Exit Sub
End Select
If TypeName(Item) = "MailItem" Then
Item.Subject = chosenvalue & Item.Subject
End If
strSubject = Item.Subject
strSubject = Replace(strSubject, "*OPO* ", "")
strSubject = "*OPO* " & strSubject
Item.Subject = strSubject
Dim olApp As Outlook.Application
Dim aItem As Object
End Sub
I have the below code to prompt a user if an email about to be sent is to be tracked or not.
if selected to be tracked the prefix *OPO * is added into the front end of the subject box, there is a little proportion of coding at the end of the sub to remove duplicate prefixes when forwarding etc.
I'm completely stuck as to how to get the selection of option button one that drives the prefix to also automate the input of an email address into the CC field. If option button two is selected no email is to be entered.
Current coding I've figured out is below and is held in ThisOutlookSession, any help appreciated.
Thanks,
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim frm As UserForm1
Dim chosenvalue As String
Set frm = New UserForm1
frm.Show vbModal
Select Case True
Case frm.OptionButton1.Value
chosenvalue = "*OPO* "
Case frm.OptionButton2.Value
chosenvalue = ""
Case Else
MsgBox "You did not select a value, Cancelling send."
Cancel = True
Exit Sub
End Select
If TypeName(Item) = "MailItem" Then
Item.Subject = chosenvalue & Item.Subject
End If
strSubject = Item.Subject
strSubject = Replace(strSubject, "*OPO* ", "")
strSubject = "*OPO* " & strSubject
Item.Subject = strSubject
Dim olApp As Outlook.Application
Dim aItem As Object
End Sub