:: On Tue, 29 Mar 2022 03:12:32 -0700 (PDT)
:: (microsoft.public.vb.general.discussion)
:: <
651b0e35-d3f2-4d12...@googlegroups.com>
Instead of using your program path, use the suggested folders for
additional data which you may want to read/write at runtime, the paths
for those folders can be easily retrieved from the environment
variables, to start, fire a command prompt and try entering the
following commands
echo %PROGRAMDATA%
echo %APPDATA%
echo %LOCALAPPDATA%
the results will be the pathnames for the global program data (for all
users, global to the machine), for the "roaming" program data and for
the "local" program data
To obtain the same informations from VB you'll just need to issue a
command like
sProgData = Environ("PROGRAMDATA")
now, to use the path, willing to follow the "rules" you should create a
subfolders structure inside the path, for example
sMyProgData = sProgData & "\MyCompanyName\MyProgramName"
by the way you should create both the "company" and "program"
subfolders, but once done, you may store whatever file you want inside
that folder; in the above example, the resulting path will be the
global one, that is common for ANY user logging onto that machine,
willing to save "per user" settings you'll do so by setting the path to
sUserData = Environ("APPDATA")
or either
sUserData = Environ("LOCALAPPDATA")
and, again, your data path will be
sThisUserData = sUserData & "\MyCompanyName\MyProgramName"
and, all the user specific data will be saved there; the suggestion is
to use the global program data to save global program settings and data
and then use the per-user data folder to save the user specific
settings which may, eventually, override some of the global settings
Let me try an example, let's say you have an email client program, such
a program may store the global settings like trusted certificates,
default settings and so on inside the "PROGRAMDATA" subfolder, while
the infos related to the email accounts and the related data will
instead be stored under "APPDATA" so that each user will have his/her
own set of data and settings