0

Hi I am looking to have a dialogue box that opens up so that the user can input a number and change the subject line of multiple selected (highlighted) emails.

The below code works only on one email and not the others that I have highlighted:

Sub AddFileNumber()

Dim myo1App As Outlook.Application
Dim aItem As Object

Set myo1App = CreateObject("Outlook.Application")
Set mail = myo1App.ActiveExplorer.CurrentFolder

Dim iItemsUpdated As Integer
Dim strTemp As String
Dim strFilenum As String

strFilenum = InputBox("Enter Number")
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 myo1App = Nothing

End Sub

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.