Copy everything in the shaded area (between Code Start and Code End) into a
new module (not a class module nor a module associated with a form or
report).
Change
Shell pathname:=("""C:\Program Files\Microsoft
Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde"" /WRKGRP
""C:\Program Files\myFolder\secure.mdw""")
to
Dim strPath As String
strPath = SpecFolder(CSIDL_APPDATA)
Shell _
pathname:=("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""" & _
strPath & "\Prg.mde"" /WRKGRP """ & strPath & "\secure.mdw""")
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"John G" <(E-Mail Removed)> wrote in message
news:6D2EB611-AC16-4FCD-AA27-(E-Mail Removed)...
> Thanks Doug!
>
> I was trying to use SpecFolder(CSIDL_APPDATA) which I got from
> http://www.mvps.org/access/api/api0054.htm but I didn't know how to use it
> in
> the command line. See my first post.
>
> John G
>
> "Douglas J. Steele" wrote:
>
>> While %AppData% works in BAT files, in VBA, you need to use the Environ
>> function:
>>
>> Shell pathname:=("""C:\Program Files\Microsoft
>> Office\OFFICE11\MSACCESS.EXE"" """ & Environ("AppData") & "\Prg.mde""
>> /WRKGRP
>> """ & Environ("AppData") & "\secure.mdw""")
>>
>> Another alternative would be to use the code from
>> http://www.mvps.org/access/api/api0054.htm to determine the location.
>>
>> --
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>>
>> "Chris O'C via AccessMonster.com" <u29189@uwe> wrote in message
>> news:9308398baef8d@uwe...
>> > Use environment variables. The built in environment variable you want
>> > is
>> > %
>> > AppData%. For Windows XP it returns
>> >
>> > {SystemDrive}:\Documents and Settings\{username}\Application Data
>> >
>> > For Vista and Windows 7 it returns
>> >
>> > {SystemDrive}:\Users\{username}\AppData\Roaming
>> >
>> > Example usage:
>> >
>> > %AppData%\myFolder\Prg.mde
>> >
>> > Chris
>> >
>> >
>> > John G wrote:
>> >>Running MS Access 2003 on Windows XP
>> >>Is it possible to run a command line switch without knowing the exact
>> >>paths?
>> >>The following command line works good as long as the files "Prg.mde"
>> >>and
>> >>"secure.mdw" are in C:\Program Files\myFolder\.
>> >>
>> >>Shell pathname:=("""C:\Program Files\Microsoft
>> >>Office\OFFICE11\MSACCESS.EXE"" ""C:\Program Files\myFolder\Prg.mde""
>> >>/WRKGRP
>> >>""C:\Program Files\myFolder\secure.mdw""")
>> >>
>> >>I know that the files will be at "C:\Documents and
>> >>Settings\username\Application Data" (in Windows XP) but the username is
>> >>different on every computer. So if the exact path of files "PRG.mde"
>> >>and
>> >>"secure.mdw" is not known; is there a way to use the following in the
>> >>above
>> >>command line?
>> >>
>> >>SpecFolder(CSIDL_APPDATA) 'Returns "C:\Documents and
>> >>Settings\username\Application Data" (in Windows XP) and returns
>> >>"C:\Users\username\AppData\Roaming" (in Windows Vista)
>> >>dbPath = SpecFolder(CSIDL_APPDATA) & "\myFolder\Prg.mde" 'Returns
>> >>"C:\Documents and Settings\username\Application Data\myFolder\Prg.mde"
>> >
>> > --
>> > Message posted via http://www.accessmonster.com
>> >
>>
>>