mlagrange
asked on
Open Windows Explorer with wildcard filter?
Hello, a while back, I got help with opening Windows Explorer (in Windows XP) from Access (2003):
strFldr = "C:\MyFolder"
strCmd = "explorer.exe /e, " & strFldr
dblTaskIDWeTempFldr = Shell(strCmd, vbNormalFocus)
Is there a way to add a wildcard filter expression to that? I have trial'd & error'd my way through the examples below, shown on this page:
"Explorer.exe Command-Line Options for Windows XP"
http://support.microsoft.com/kb/314853
...but no luck. I need to open up Windows Explorer on a particular folder that contains many, many, many, thousands of pdf's, filtered to the ones they just produced in a related process. (WE, so they can double-click on any one of them to open and inspect it)
Thanks
strFldr = "C:\MyFolder"
strCmd = "explorer.exe /e, " & strFldr
dblTaskIDWeTempFldr = Shell(strCmd, vbNormalFocus)
Is there a way to add a wildcard filter expression to that? I have trial'd & error'd my way through the examples below, shown on this page:
"Explorer.exe Command-Line Options for Windows XP"
http://support.microsoft.com/kb/314853
...but no luck. I need to open up Windows Explorer on a particular folder that contains many, many, many, thousands of pdf's, filtered to the ones they just produced in a related process. (WE, so they can double-click on any one of them to open and inspect it)
Thanks
Option Function
----------------------------------------------------------------------
/n Opens a new single-pane window for the default
selection. This is usually the root of the drive that
Windows is installed on. If the window is already
open, a duplicate opens.
/e Opens Windows Explorer in its default view.
/root,<object> Opens a window view of the specified object.
/select,<object> Opens a window view with the specified folder, file,
or program selected.
Examples
-----------------------------------------------------------------------
Example 1: Explorer /select,C:\TestDir\TestProg.exe
Opens a window view with TestProg selected.
Example 2: Explorer /e,/root,C:\TestDir\TestProg.exe
Opens Explorer with drive C expanded and TestProg selected.
Example 3: Explorer /root,\\TestSvr\TestShare
Opens a window view of the specified share.
Example 4: Explorer /root,\\TestSvr\TestShare,select,TestProg.exe
Opens a window view of the specified share with TestProg selected.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The Function TestIt() in the link shows another example for calling the Open Save dialog.
ASKER
Thanks, but the users will need the functionality of WE, rather than the Open/Save dialog.
The goal here is to show them all the pdf's that were just created in a mail merge process, and let them spot check various ones to confirm the mail merge worked ok.
The FileOpen dialog closes after selecting a single file, and they would have to keep opening it back up.
I have found sample code for the FileSearch object model (by Ken Getz, in the 2002 Developers Handbook). Just as it is, it would display the files names in a list box, and I could Shell() on the double-click.
It would be so much easier to just open WE to a particular directory, with a wildcard filter in effect. I would have thought somebody would have worked up an API for the Windows Search Companion, but I have Google'd far & wide, and don't see anything like that...
The goal here is to show them all the pdf's that were just created in a mail merge process, and let them spot check various ones to confirm the mail merge worked ok.
The FileOpen dialog closes after selecting a single file, and they would have to keep opening it back up.
I have found sample code for the FileSearch object model (by Ken Getz, in the 2002 Developers Handbook). Just as it is, it would display the files names in a list box, and I could Shell() on the double-click.
It would be so much easier to just open WE to a particular directory, with a wildcard filter in effect. I would have thought somebody would have worked up an API for the Windows Search Companion, but I have Google'd far & wide, and don't see anything like that...
Ah, forgot about that. It is very easy to load a listbox with filenames in a folder using the Dir Function.
I would suggest using the Open Save dialog for that. You can apply a filter to display the files you want. The Open Save dialog will return the selected path/filename which you can open with the shell command or they could be opened in a window in your db.
Take a look at http://www.mvps.org/access/api/api0001.htm.
Note: Just copy and paste code after
'***************** Code Start **************
to its own module.
The code above
'***************** Code Start **************
is an example on how to call the Open Save dialog.