changing FW: on forward

Status
Not open for further replies.

rinu

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Hi All,

I am new to VBA so any help will be greatly appreciated . I have to forward a mail from specific subject but need to get rid of FW: from the subject along with the signature and old users subject, emails...etc.

how do i do it ?

Regards
Roma
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
i have samples here Run a Script Rule: Change Subject then Forward Message

changing the subject and removing the forward header and your signature is a piece of cake, removing the original sender's signature is more difficult, especially if they don't use a signature separator - you need to know where to split it.
 

rinu

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
Hi Diane,
I was able to get it work with the below code. But it seems to be messing up the formating. After running the below code all the Rich text content seems to be missing from the body.

Sub RemoveExpression()

Dim Insp As Inspector
Dim obj As Object
Dim subStr As String
Dim oMail As MailItem
Dim itmOld As MailItem, itmNew As MailItem
Set Insp = Application.ActiveInspector
Set oMail = Insp.CurrentItem

lPosition = InStr(oMail.Body, "Subject: ") - 1
' obj.Subject = Mid(oMail.Subject, 5)
subStr = Left(oMail.Body, lPosition)
oMail.Body = Replace(oMail.Body, subStr, "")
oMail.Subject = Replace(oMail.Subject, "FW:", "")

'obj.Body = Replace(obj.HTMLBody, "abc", "")
Set obj = Nothing
Set Insp = Nothing
End Sub
 

rinu

New Member
Outlook version
Outlook 2013 64 bit
Email Account
Office 365 Exchange
I did it with the below code
Sub RemoveExpression()
Dim Insp As Inspector
Dim subStr As String
Dim oMail As MailItem
Dim itmOld As MailItem, itmNew As MailItem
Set Insp = Application.ActiveInspector
Set oMail = Insp.CurrentItem
lPosition = InStr(oMail.HTMLBody, "Subject:") + 7 + (Len(oMail.Subject)) + 1
subStr = Left(oMail.HTMLBody, lPosition)
oMail.HTMLBody = Replace(oMail.HTMLBody, subStr, "")
oMail.Subject = Replace(oMail.Subject, "FW:", "")
Set obj = Nothing
Set Insp = Nothing
End Sub
 
Status
Not open for further replies.
Top