Subject: Shell Command
You could locate the installation directory from the registry. At a glance, it looks like you could get the information needed with this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MSACCESS.EXE
Here are a few ideas for reading the registry key:
use the Win32 API (see function below),
use Windows Scripting Host - see here for more info (pretty easy stuff . . . cool too), or
use @RegQueryValue.
hth,
dgg
Declare Private Function W32RegOpenKeyEx Lib “advapi32.dll” Alias “RegOpenKeyExA” ( _
Byval hKey As Long, _
Byval lpSubKey As String, _
Byval ulOptions As Long, _
Byval samDesired As Long, _
phkResult As Long _
) As Long
Declare Private Function W32RegQueryValueEx Lib “advapi32.dll” Alias “RegQueryValueExA” ( _
Byval hKey As Long, _
Byval lpValueName As String, _
Byval lpReserved As Long, _
lpType As Long, _
Byval lpData As String, _
lpcbData As Long _
) As Long
Declare Private Function W32RegCloseKey Lib “advapi32.dll” Alias “RegCloseKey” ( _
Byval hKey As Long _
) As Long
Public Function getRegistryKeyValue(plngHMainKey As Long, pblnAppend As Boolean, pstrSubKey As String, pstrKeyName As String, pstrValOut As String) As Boolean
'// +++ GLOBAL VARIABLES +++
'// Constants:
'// none
'//
'// Class instances:
'// none
'//
'// Primitives:
'// none
'//
'// 06/28/2004 - Dallas Gimpel
'//
'// DESCRIPTION:
'// This function allows a registry key value to be retrieved via Win/32 API.
'//
'// NOTE:
'// These are the constants for the main registry to be passed by the calling module as
'// the first parameter:
'// Const HKEY_CLASSES_ROOT = &H80000000
'// Const HKEY_CURRENT_USER = &H80000001
'// Const HKEY_LOCAL_MACHINE = &H80000002
'// Const HKEY_USERS = &H80000003
'// Const HKEY_PERFORMANCE_DATA = &H80000004
'//
'// INPUT:
'// plngHMainKey - Long, the main key to be used for querying the registry
'// pblnAppend - Boolean, indicates whether or not to append results to the string passed
'// pstrSubKey - String, the sub key to be used for querying the registry
'// pstrKeyName - String, the key name whose value is to be retrieved
'//
'// OUTPUT:
'// pstrValOut - String, receives the registry value retrieved (if any)
'// Function returns a boolean (true if successfull, otherwise false).
On Error Goto errorHandler
'// These are for the W32 API
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_CREATE_LINK = &H20
Const READ_CONTROL = &H20000
Const WRITE_DAC = &H40000
Const WRITE_OWNER = &H80000
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const STANDARD_RIGHTS_READ = READ_CONTROL
Const STANDARD_RIGHTS_WRITE = READ_CONTROL
Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
Const STANDARD_RIGHTS_ALL = &H1F0000
Const KEY_READ = (STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And Not SYNCHRONIZE
Const KEY_WRITE = (STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY) And Not SYNCHRONIZE
Const KEY_EXECUTE = KEY_READ And Not SYNCHRONIZE
Const KEY_ALL_ACCESS = (STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And Not SYNCHRONIZE
Const REG_SZ = 1
Dim lngRetCode As Long
Dim lngHKey As Long
Dim lngKeyType As Long
Dim lngBuffLen As Long
Dim strBuffer As String
getRegistryKeyValue = False
lngRetCode& = W32RegOpenKeyEx(Byval plngHMainKey&, Byval pstrSubKey$, 0&, KEY_ALL_ACCESS, lngHKey&)
If lngRetCode& = 0 Then
lngBuffLen& = 255
strBuffer$ = String(lngBuffLen&, 0)
lngRetCode& = W32RegQueryValueEx(lngHKey&, pstrKeyName$, lngKeyType&, 0&, strBuffer$, lngBuffLen&)
lngRetCode& = W32RegCloseKey(lngHKey&)
strBuffer$ = Strleftback(Left$(strBuffer$, lngBuffLen&), Chr(0))
If pblnAppend Then
pstrValOut$ = pstrValOut$ & strBuffer$
Else
pstrValOut$ = strBuffer$
End If
getRegistryKeyValue = True
End If
functionExit:
Exit Function
errorHandler:
Msgbox "Error & " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & ".", , "Error encountered . . ."
Print "Error & " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & " . . ."
Resume functionExit
End Function