hello everyone,
Sorry for my english.
i found the script to change the subject of mails. The script runs over a rule. Unfortunately the script only works in an email where it is active.
I have 10 emails in a test folder. Rest of the mails does not work.
I chose by rule: Apply rule to all messages.
Can someone help me find out why the rest of the emails don't work.
Thank you.
Public Sub EditSubject(Mail As Outlook.MailItem)
Dim Item As Outlook.MailItem
Dim oInspector As Inspector
Dim strSubject As String
Dim strPrefixSubject As String
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
Set Item = Application.ActiveExplorer.Selection.Item(1)
Else
Set Item = oInspector.CurrentItem
End If
strSubject = "AW: "
Debug.Print Item.subject
Item.subject = Replace(Item.subject, strSubject, "", vbTextCompare)
Item.Save
' Prefix subject with Confidential and Legally Privileged
strPrefixSubject = "" & Item.subject
' Set the message subject
Item.subject = strPrefixSubject
Item.Save
Set Item = Nothing
Set oInspector = Nothing
End Sub
Sorry for my english.
i found the script to change the subject of mails. The script runs over a rule. Unfortunately the script only works in an email where it is active.
I have 10 emails in a test folder. Rest of the mails does not work.
I chose by rule: Apply rule to all messages.
Can someone help me find out why the rest of the emails don't work.
Thank you.
Public Sub EditSubject(Mail As Outlook.MailItem)
Dim Item As Outlook.MailItem
Dim oInspector As Inspector
Dim strSubject As String
Dim strPrefixSubject As String
Set oInspector = Application.ActiveInspector
If oInspector Is Nothing Then
Set Item = Application.ActiveExplorer.Selection.Item(1)
Else
Set Item = oInspector.CurrentItem
End If
strSubject = "AW: "
Debug.Print Item.subject
Item.subject = Replace(Item.subject, strSubject, "", vbTextCompare)
Item.Save
' Prefix subject with Confidential and Legally Privileged
strPrefixSubject = "" & Item.subject
' Set the message subject
Item.subject = strPrefixSubject
Item.Save
Set Item = Nothing
Set oInspector = Nothing
End Sub