VB Script, remove text from subject line when forwarding

Status
Not open for further replies.

aom

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi, So I see this macro, but don't see a "sun name" to replace with the code you provide in post #19:

Option Explicit
Private WithEvents oExpl As Explorer
Private WithEvents oItem As MailItem
Private bDiscardEvents As Boolean



Private Sub Application_Startup()
Set oExpl = Application.ActiveExplorer
bDiscardEvents = False
End Sub


Private Sub oExpl_SelectionChange()
On Error Resume Next
Set oItem = oExpl.Selection.Item(1)
End Sub


' Reply
Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)


Dim oAtt As Attachment
Dim strAtt As String
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection


If bDiscardEvents Or oItem.Attachments.Count = 0 Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True
strAtt = ""


For Each oAtt In oItem.Attachments
If oAtt.Size > 5200 Then
strAtt = strAtt & "<<" & oAtt.FileName & ">> "
End If
Next oAtt


Dim oResponse As MailItem
Set oResponse = oItem.Reply
oResponse.Display
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection


olSelection.InsertBefore strAtt

bDiscardEvents = False
Set oItem = Nothing
End Sub


' Reply All
Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)


Dim oAtt As Attachment
Dim strAtt As String
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection


If bDiscardEvents Or oItem.Attachments.Count = 0 Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True


strAtt = ""

For Each oAtt In oItem.Attachments
If oAtt.Size > 5200 Then
strAtt = strAtt & "<<" & oAtt.FileName & ">> "
End If
Next oAtt


Dim oResponse As MailItem
Set oResponse = oItem.ReplyAll
oResponse.Display
Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection


olSelection.InsertBefore strAtt
bDiscardEvents = False
Set oItem = Nothing
End Sub
 

aom

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Oh thank you for clarifying. Sorry for being a bit inexperienced on coding (it's one of my many flaws!). Would you mind if you could combine the code snippet that Dianne provided me with the example I pulled so I can see how it's supposed to look like?
 
Status
Not open for further replies.
Top