Skip to content

Instantly share code, notes, and snippets.

@ijd65
Created July 17, 2013 07:33
Show Gist options
  • Save ijd65/6018458 to your computer and use it in GitHub Desktop.
Save ijd65/6018458 to your computer and use it in GitHub Desktop.
Renames the subject of the selected Outlook email
Private Sub Rename()
'Dim olTask As Outlook.TaskItem
'Using object so all items can be processed
Dim olitem As Object
Dim olExp As Outlook.Explorer
Dim fldCurrent As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Set olApp = Outlook.CreateObject("Outlook.Application")
Set olExp = olApp.ActiveExplorer
Set fldCurrent = olExp.CurrentFolder
Dim cntSelection As Integer
cntSelection = olExp.Selection.Count
For i = 1 To cntSelection
Set olitem = olExp.Selection.Item(i)
' Mark as unread
olitem.UnRead = False
'olitem.Sensitivity = olNormal
olitem.Save
newName = InputBox("Enter the revised subject:", "New Subject", olitem.Subject)
' OL07 uses the property .TaskSubject
olitem.Subject = newName
olitem.Save
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment