I recently added this macro to my 2003 outlook visual basic editor. It has been a real Godsend and has been exactly what I have been looking for after months of searching. Thank You Blue Devil Fan for the code.
The macro worked flawlessly for weeks, then all of the sudden I am getting the following message:
Run-time err '13'
The macro then gives me the option to debug the code. When that is selected, the visual basic editor highlights code line #16, which is the last "Next" in the code.
I researched this problem, and Microsoft recommended installing service pack #3 for Office 2003, and service pack #3 for Windows XP. I did both and nothing is working.
I desperately need this macro to work again.
Please let me know if you have any recommendations.
Thank You Expert!
Const MACRONAME = "Fix Subject Line"
Dim olkMsg As Outlook.MailItem, _
olkItems As Outlook.Items, _
strSubject As String, _
strNewSub As String
strSubject = InputBox("What word/phrase do you want me to search for?", MACRONAME)
strNewSub = InputBox("What text do you want to replace the word/phrase with?", MACRONAME)
If strSubject <> "" Then
Set olkItems = Application.ActiveExplorer.CurrentFolder.Items
For Each olkMsg In olkItems
If InStr(1, olkMsg.Subject, strSubject) Then
olkMsg.Subject = Replace(olkMsg.Subject, strSubject, strNewSub)
Set olkItems = Nothing
Set olkMsg = Nothing
MsgBox "All done!", vbInformation + vbOKOnly, MACRONAME