【问题标题】:Find Replace in Contact Notes Macro在通讯录宏中查找替换
【发布时间】:2020-09-03 20:59:13
【问题描述】:

我正在尝试构建一个宏来删除散布在 MS Outlook 联系人备注字段中的一系列电子邮件。这是我到目前为止所拥有的,当它执行时,似乎没有任何可见的事情发生。感谢任何反馈。 电子邮件看起来像<name@xyz.com>

Sub OutlookDeleteTextBetween()
Dim olInspector As Outlook.Inspector
Dim olDocument As Word.Document
Dim olSelection As Word.Selection

Set olInspector = Application.ActiveInspector()
Set olDocument = olInspector.WordEditor
Set olSelection = olDocument.Application.Selection
olSelection.WholeStory

With olSelection.Find
      .Text = "\<*\>"
      .MatchWildcards = True
      .Replacement.Text = ""
      .Execute Replace:=wdReplaceAll
End With
End Sub

【问题讨论】:

    标签: vba email outlook contacts


    【解决方案1】:

    删除散布在 MS Outlook 联系人备注字段中的一系列电子邮件

    在您进行一些更改后尝试Save 邮件项目。在您保存项目或重新打开窗口之前,Outlook 可能不会传播更改。

    如果您需要查找附加的邮件项目,它们将作为附件存储在 Outlook 项目中。在您看来,您需要检查 Attachments 集合并使用从集合中删除对象的 Attachments.Remove 方法。例如:

    Sub RemoveAttachmentBeforeForwarding()  
     Dim myinspector As Outlook.Inspector  
     Dim myItem As Outlook.MailItem  
     Dim myattachments As Outlook.Attachments 
    
     Set myinspector = Application.ActiveInspector  
     If Not TypeName(myinspector) = "Nothing" Then  
       Set myItem = myinspector.CurrentItem.Forward  
       Set myattachments = myItem.Attachments  
       While myattachments.Count > 0  
         myattachments.Remove 1  
       Wend  
       myItem.Display  
       myItem.Recipients.Add "Eugene Astafiev"  
       myItem.Send  
     Else  
       MsgBox "There is no active inspector."  
     End If  
    End Sub
    

    【讨论】:

    • 问题有点不清楚,我正在尝试删除一系列电子邮件地址,(不是电子邮件)基本上,搜索“”之间的任何文本并替换为“ "
    • 在您进行一些更改后尝试Save 邮件项目。在您保存项目或重新打开窗口之前,Outlook 可能不会传播更改。
    猜你喜欢
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 2018-04-11
    • 1970-01-01
    • 2015-01-03
    • 2011-03-28
    • 1970-01-01
    • 2015-10-06
    相关资源
    最近更新 更多