Link to home
Start Free TrialLog in
Avatar of Hiro 714
Hiro 714

asked on

MS Access Question: how to launch file explorer

Hi Experts,
I would like to launch file explorer from MS access by clicking a button with certain path.
Would you advise me?
ASKER CERTIFIED SOLUTION
Avatar of Daniel Pineault
Daniel Pineault

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Depends on what you want to do.  If you want to select a file to be used by your application, or select a folder to be used to store a file you are exporting from your applicaiton, you will need to use the FileDialog object.  There are numerous examples here in EE about how to use the FileDialog feature.  I suggest you search on that term.
Avatar of Daniel Pineault
Daniel Pineault

Very valid point Dale!  

If this is to allow the user to select a file and return the filename to the application, then you should be looking at using the FileDialog, see: https://www.devhut.net/2016/10/04/late-binding-the-filedialog/
By using the Shell method:

Shell "explorer.exe ""C:\Temp\"""

Open in new window


E.g. as method do handle the path escaping:

Option Compare Database
Option Explicit

Public Sub ExplorerOpenDirectory(ByVal CPath As String)

  Const DELIMITER As String = """"
  Const EXPLORER As String = "explorer.exe ""?"""

  Shell Replace(EXPLORER, "?", Replace(CPath, DELIMITER, DELIMITER & DELIMITER)), vbNormalFocus

End Sub

Open in new window