Skip to content

Instantly share code, notes, and snippets.

@logic2design
Last active August 29, 2020 10:27
Show Gist options
  • Save logic2design/38ab8c49bc1a54a1648e4cb76db25fd3 to your computer and use it in GitHub Desktop.
Save logic2design/38ab8c49bc1a54a1648e4cb76db25fd3 to your computer and use it in GitHub Desktop.
Renames the subject of the selected Outlook email https://gist.github.com/38ab8c49bc1a54a1648e4cb76db25fd3
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