How to determine the installation path of MS Access

I have a MS Access command line call like this:

%Programfiles%\Office11\msaccess.exe 

How can I remove the "Office11" part so that the called call will execute any version of MS Access that has been installed? I have to run this on the command line, so the option to use the Start> Run dialog is not applicable.

+4
source share
2 answers

You can read the registry to find the folder where MSACCESS.EXE is located. Here is an example of VBScript.

 Option Explicit Dim MSAccPath Dim RegKey Dim WSHShell RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\" _ & "CurrentVersion\App Paths\MSACCESS.EXE\Path" Set WSHShell = WScript.CreateObject("WScript.Shell") MSAccPath = WSHShell.RegRead(RegKey) WScript.Echo "MS Access Path: " & MSAccPath & "MSACCESS.EXE" Set WSHShell = Nothing 
+4
source

If you want to do this using your own MS Access function: SysCmd(acSysCmdAccessDir)

+2
source

All Articles