When facing myriad search results, you may hope to determine their located folder paths. Outlook has no such a native support for it. But you still can make use of VBA codes to achieve it. This article will expose the elaborate steps to you.
In my previous article – “4 Ways to Identify the Located Folder of the Search Results”, I have introduced 4 means to get the located folder of the search results. But all of them can just provide the located folder name. So there will be a trouble by these means. For example, if you have several folders in the same name, using these methods will not permit you to identify which folder the search results are exactly in. In this situation, you must hope to get the folder path instead of simply a folder name. As Outlook has no direct feature to support this, you have to recur to Outlook VBA. Here are the detailed codes and steps.
Get the Full Folder Paths of the Search Results
- In the first place, you should start Outlook and head to “Developer” tab.
- Then in the ribbon, locate and click on “Visual Basic” button, which will open the VBA editor window.
- Next you ought to open a new module and copy the following codes into the module window.
Sub GetFolderPathofSelectedItem() Dim olSel As Selection Dim olItem As Object Dim olFolder As Folder Dim olFPath As String Dim strMsg As String Dim Dataobj As DataObject Set olSel = Outlook.Application.ActiveExplorer.Selection Set olItem = olSel.Item(1) olFPath = olItem.Parent.FolderPath strMsg = "The selected item is located at " & olFPath & "." & vbCrLf & "Do you want to copy the folder path or siwtch to the folder?" & vbCrLf & vbCrLf & "Click " & Chr(34) & "Yes" & Chr(34) & " to copy" & vbCrLf & "Click " & Chr(34) & "No" & Chr(34) & " to siwtch to the folder" & vbCrLf & "Click " & Chr(34) & "Cancel" & Chr(34) & " to close the dialog box." nRes = MsgBox(strMsg, vbInformation + vbYesNoCancel, "Get Item Folder Path") Select Case nRes Case vbYes Set Dataobj = New MSForms.DataObject Dataobj.SetText olFPath Dataobj.PutInClipboard Case vbNo Set Outlook.Application.ActiveExplorer.CurrentFolder = olItem.Parent End Select End Sub
- After that, you can exit the current window and click on “Macro settings” on the “Developer” tab. In the popup window, set the macro level to low.
- Subsequently, you should add the new macro to Quick Access Toolbar.
- Firstly, click the down arrow in Quick Access Toolbar and choose “More Commands” from the drop down list.
- Then in the emerging window, take the following steps shown in the screenshot below:
- Finally, you can have a try.
- First, perform an instant search in “All Items” search scope.
- Then pitch on one search result and hit the macro button in the Quick Access Toolbar.
- At once, you will receive a message box, which will contain the detailed folder path and three action options, like the following image:
- If you click “Yes”, you will copy the folder path to the clipboard. If you hit “No”, you will immediately move to the folder of the selected item. If you want to stay in the search result list, you can simply hit “Cancel”.
Get back Your Precious Outlook Data
Outlook is vulnerable, thus sometimes you may unfortunately suffer Outlook PST data corruption. Under this circumstance, you will be unable to access your PST data any longer. You will be required to use some preeminent and proven repair tool, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair corrupt SQL Server mdf data and outlook repair software products. For more information visit www.datanumen.com