Find a file on the computer

  • Thread starter Thread starter ReidarT
  • Start date Start date
R

ReidarT

I want to copy a shortcut to the desktop (Access application) and therefore
I want to find the 'msaccess.exe' on the computer.

Is there a way to get the path to the msaccess.exe file?
And second, how do I address the users desktop like %system%my documents...

regards
reidarT
 
Are you trying to do this in side of ms-access?

To get the path name to msaccess.exe in code, you can use:

SysCmd(acSysCmdAccessDir),

So, the full pathname to msaccess.exe would be:

SysCmd(acSysCmdAccessDir) & "msaccess.exe"

You can also use the envornt var to get other common settings

In the debug window, try:

? environ("userprofile")
C:\Documents and Settings\Albert

So, desktop would be:

? environ("userprofile") & "\desktop"

If you are using an installer, then the path name (for access 2003) can be
found:

HKLM\SOFTWARE\Microsoft\Office\11.0\Access\InstallRoot\,Path
 
Hi Reidar...

I think you are trying to distribute your application, and want to make sure
it hits the right place on every machine, and everyone can see the icon on
their desktop. I did this recently for 150 users, and had to make common
defaults for it to work.

First point
I am assuming you are using Access 97, which is located as

c:\Program Files\Microsoft Office\Office\msaccess.exe

and then your database should be located in a specific directory on their
hard drive, aka

c:\databases\mydatabase_frontend.mdb

then the shortcut command line should read:
(and include all " " quotes)

"c:\Program Files\Microsoft Office\Office\msaccess.exe"
"c:\databases\mydatabase_frontend.mdb"
(all on one line, watch for word wrap)

For other versions of Office, ie Office XP, change the above \Office\ to
\Office10\ ... and so on...

Second Point
Addressing each user's desktop can be very difficult, because they all have
different usernames! That makes automation of copying new versions very
difficult, and even more so when you have 150 users ! BUT, if you want to
place the shortcut in a generic place, then use this shortcut address...

c:\documents and settings\all users\desktop

doing that will place the shortcut icon on every user's desktop, no matter
how many users 'use' the same machine, or which machine they are on.

Make sense?

DubboPete
 
Hi,

The Windows Script Host Shell object exposes a subset of special
folders, e.g.:

set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("AllUsersDesktop")

If you don't like to use scripting objects, there's the Windows API
function SHGetSpecialFolderLocation, which underlies the
WshShell.SpecialFolders object. There's sample VB/A code for it in the
API Guide at www.allapi.net.

Similarly, you can create a shortcut with either
WshShell.CreateShortcut
or the
fCreateShellLink
API function.
 
Back
Top