【发布时间】:2022-01-15 22:19:58
【问题描述】:
我正在使用工作正常的 DASL 过滤器过滤 Outlook。但是当清除过滤器时,过滤的内容会被重置,但它不会在底部显示电子邮件的数量。它显示为“已应用过滤器”。所以我需要手动去清除 DASL 过滤器的值。
我们能否在不更改我所在的现有视图的情况下通过 VBA 将 DASL 过滤器清除为默认值?
对于清除过滤器,我在发布的答案中使用相同的代码。它清除数据。但它不会清除状态栏中的文本,并且一直显示“已应用过滤器”。
Public Sub FilterView()
Dim objView As View
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Set olApp = New Outlook.Application
On Error Resume Next
Set olMail = olApp.ActiveInspector.currentItem
On Error GoTo 0
If olMail Is Nothing Then
On Error Resume Next
Set olMail = olApp.ActiveExplorer.Selection.Item(1)
On Error GoTo 0
End If
If Not olMail Is Nothing Then
SName = olMail.Sender
Else
MsgBox "Active item is not an email or no email selected"
End If
Set objView = Application.ActiveExplorer.CurrentView
QueryV = "urn:schemas:mailheader:sender = " & Chr(39) & SName & Chr(39)
objView.Filter = QueryV
objView.Save
End Sub
【问题讨论】:
-
您在 Outlook 中使用什么代码进行筛选?您是否将筛选器应用于 Outlook 中的文件夹视图?