Search companion

voycron

New Member
Joined
Apr 5, 2010
Messages
6
The following code opens search companion and automatically enters the drive, but not the filename. Can this code be alter to also add filename and start the search?


>>>>>>>>>>>>>>>>>>>>>>>>>
Option Explicit
'API declaration for the windows "Search Results" dialog
Private Declare Function ShellSearch& Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long)

Private Const SW_SHOWNORMAL = 1

Sub ShowWindowsSearchDialog_API()
' Specified drive to Search
Const szSDrive As String = "\\jt3cx\Recordings\103\"
ShellSearch 0, "find", szSDrive, "", "", SW_SHOWNORMAL
End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I'm no VBA guru, but here's an example of what I've used multiple times.
Code:
'Open TEMPLATE file
Dim FilePath As String
FilePath = "[URL="file://oafs4/Finance$/Budget/2011"]\\oafs4\Finance$\Budget\2011[/URL] Budget\Final Budgets\Master - 2011 Budget Report.xlsx"
Workbooks.Open Filename:=FilePath

I don't know if you can accomplish the same by simply adding the file name to your
Code:
Const szSDrive As String = "\\jt3cx\Recordings\103\"
 
Upvote 0
the reason why im trying to use search companion is because i am not searching for a workbook or any excel extentions. I want to be able to search for example a *.wav or *.jpeg file
 
Upvote 0

Forum statistics

Threads
1,224,508
Messages
6,179,189
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top