Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Outlook VBA中知道当前视图是否为搜索结果视图?_Vba_Outlook - Fatal编程技术网

如何在Outlook VBA中知道当前视图是否为搜索结果视图?

如何在Outlook VBA中知道当前视图是否为搜索结果视图?,vba,outlook,Vba,Outlook,我想对每个Outlook.Explorer\u SelectionChange事件执行VBA操作,但是,仅当浏览器显示搜索结果时。有没有办法确定当前是否显示搜索结果?一种可能的方法是解析.FolderPath Sub-identifySearchFolder() 将文件夹设置为文件夹 Dim currFolderPath作为字符串 Dim txtSearch作为字符串 Dim pathSearch作为字符串 txtSearch=“已收到:本周” pathSearch=“\search文件夹” 设

我想对每个Outlook.Explorer\u SelectionChange事件执行VBA操作,但是,仅当浏览器显示搜索结果时。有没有办法确定当前是否显示搜索结果?

一种可能的方法是解析
.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
如果结束
端接头

谢谢-对我来说已经足够好了。