我有一个Outlook VBA脚本,提示我输入一个旧单词和一个新单词,然后将所有选定电子邮件的“旧单词”更改为“新单词”:
Public Sub replaceWords()
Dim item As Outlook.mailItem
oldWord = InputBox("Please enter a word to replace. Remebver to include spaces. Enter 'quit' to exit")
If oldWord = "quit" Then Exit Sub
newWord = InputBox("and now the word you'd like to replace it with")
Set oldWordRegex = New RegExp
With oldWordRegex
.Pattern = oldWord
.Global = True
End With
For Each item In Application.ActiveExplorer.Selection
If TypeName(item) = "MailItem" Then
'remove the "Issued at..." from the end of the subject and a
item.Subject = oldWordRegex.Replace(item.Subject, newWord)
item.Save
End If
Next
End Sub
据我所知,这工作正常,除了主题的更改未反映在“收件箱”主窗口中。为了演示,我给自己发送了电子邮件,主题为“这只小猪上市”,然后运行我的宏并将“小猪”更改为“青蛙”。结果显示如下:
问题:Outlook是否必须从收件箱中的电子邮件主题重建收件箱列表?如果是,您是否可以强制这样做?