如何在Outlook VBA中知道当前视图是否为搜索结果视图?
我想对每个Outlook.Explorer\u SelectionChange事件执行VBA操作,但是,仅当浏览器显示搜索结果时。有没有办法确定当前是否显示搜索结果?一种可能的方法是解析如何在Outlook VBA中知道当前视图是否为搜索结果视图?,vba,outlook,Vba,Outlook,我想对每个Outlook.Explorer\u SelectionChange事件执行VBA操作,但是,仅当浏览器显示搜索结果时。有没有办法确定当前是否显示搜索结果?一种可能的方法是解析.FolderPath Sub-identifySearchFolder() 将文件夹设置为文件夹 Dim currFolderPath作为字符串 Dim txtSearch作为字符串 Dim pathSearch作为字符串 txtSearch=“已收到:本周” pathSearch=“\search文件夹” 设
.FolderPath
Sub-identifySearchFolder()
将文件夹设置为文件夹
Dim currFolderPath作为字符串
Dim txtSearch作为字符串
Dim pathSearch作为字符串
txtSearch=“已收到:本周”
pathSearch=“\search文件夹”
设置ActiveExplorer.CurrentFolder=Session.GetDefaultFolder(olFolderInbox)
设置currFolder=ActiveExplorer.CurrentFolder
调试。打印
调试。打印“ActiveExplorer.CurrentFolder:”&currFolder
如果InStr(currFolderPath,pathSearch)则
在非搜索FolderPath:&ActiveExplorer.CurrentFolder.FolderPath中找到Debug.Print pathSearch&
其他的
调试。打印“ActiveExplorer.CurrentFolder.FolderPath:&ActiveExplorer.CurrentFolder.FolderPath”
如果结束
使用ActiveExplorer
.ClearSearch“清除以前的搜索(如果有)”
.Search txtSearch,olSearchScopeAllFolders
以
设置currFolder=ActiveExplorer.CurrentFolder
调试。打印“ActiveExplorer.CurrentFolder:”&currFolder
currFolderPath=currFolder.FolderPath
Debug.Print currFolder.FolderPath
如果InStr(currFolderPath,pathSearch)则
在FolderPath:&ActiveExplorer.CurrentFolder.FolderPath中找到Debug.Print pathSearch&
其他的
调试.打印ActiveExplorer.CurrentFolder.FolderPath
如果结束
端接头
谢谢-对我来说已经足够好了。