Starting Search Companion with VBA

cadman56

New Member
Joined
Jun 14, 2008
Messages
9
Is there a way to do this?

The user opens an excel workbook.
in cell E17 on a sheet that is named "Work" is the name of the file w/o the extension.
Example, file name is 123456Q1.xls in cell E17 is 123456
The user wants to find all files with 123456 in the file name in the Quote directory or one of its sub directories
He will run a macro called search
The macro will read cell E17, it will open the file search companion and put the contents on cell E17 into the search criteria box.
the user will then click the search button his self.

I found how to run the search box from VBA but cannot figure out how to populate the search field with the cell contents

This is the code I have so far

Code:
 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 = "[URL="file://server1/shared/QUOTES/"]\\Server1\shared\QUOTES\[/URL]"
        ShellSearch 0, "find", szSDrive, "", "", SW_SHOWNORMAL
End Sub
 
<!-- richText -->

Thank You
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Watch MrExcel Video

Forum statistics

Threads
1,123,367
Messages
5,601,214
Members
414,434
Latest member
Riyen

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
Top