AnsweredAssumed Answered

VBA Get File Name & Path from Windows Explorer Search Results

Question asked by Tom Fosler on Jun 15, 2016
Latest reply on Jun 17, 2016 by JOHN GEORGE

I have a VBA macro that is going to open a drawing. The thing is that I don't know where this drawing will be located in the file system, so I would like to use either the search functionality in the Open File dialog box or using the Shell command.

 

I tried to use this: RetVal = Shell("c:\windows\explorer.exe " & "search-ms://query=" & Filename & Paths & """", vbNormalFocus)

 

But as of yet I have found no way to select the file that shows up in the search results. I know there is a /select function within the Shell parameters, but I can't seem to get it to work within the above code. The goal here is getting the file name and file path returned from the search.


We do not have PDM. IMO the Shell function is faster than the FSO recursive, as I am searching through a large swath of directories. Definitely open to any suggestions. Thanks!

Outcomes