Patrick Moore
New Member
- Outlook version
- Outlook 2010 32 bit
- Email Account
- Exchange Server
Hi all
Disclaimer - I have no real VBA knowledge!
I have a customer who wants to be able to change the subject line on emails in batches. The below works for all messages in a folder, but they specifically want to be able to select individual mails as an option. Any help will be much appreciated!
Many thanks
Patrick
Disclaimer - I have no real VBA knowledge!
I have a customer who wants to be able to change the subject line on emails in batches. The below works for all messages in a folder, but they specifically want to be able to select individual mails as an option. Any help will be much appreciated!
Code:
Sub AddREMNumberToAllMessagesInFolder()
Dim myolApp As Outlook.Application
Dim aItem As Object
Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer
Dim strTemp As String
Dim strFilenum As String
strFilenum = InputBox("Enter the REM number to be prefixed to the subject line of ALL the messages in the current folder:")
iItemsUpdated = 0
For Each aItem In mail.Items
strTemp = "[" & strFilenum & "] " & aItem.Subject
aItem.Subject = strTemp
iItemsUpdated = iItemsUpdated + 1
aItem.Save
Next aItem
MsgBox iItemsUpdated & " of " & mail.Items.Count & " Messages Updated"
Set myolApp = Nothing
End Sub
Many thanks
Patrick