OutputTo the user's My Documents directory

  • Thread starter Thread starter John Bartley K7AAY
  • Start date Start date
J

John Bartley K7AAY

New at macros, trying to send a report to file so it will work on any
machine.
I can't figure out how to send to the TMP directory, or to MY
DOCUMENTS without knowing the user's name... what do I put in the
OutputFile box when creating a macro to send it to either
TMP (there's one on every machine), or
the user's MyDocuments directory, without hardcoding for a specific
user?

Thank you kindly.
 
New at macros, trying to send a report to file so it will work on any
machine.

I can't figure out how to send to the $TEMP or $TMP directory, or to
MY DOCUMENTS without knowing the user's name... what do I put in the
OutputFile box when creating a macro to send it to the directories
specified by the system variables $TEMP or $TMP (there's one on every
machine, either will do), or the user's MyDocuments directory, without
hardcoding for a specific user?

Been hacking away at this for a while and am stymied.

Thank you kindly.
 
To get the TEMP or TMP folders, use Environ("TEMP") or Environ("TMP")
respectively.

For My Documents, even though this is a macros group, you're best off using
the API calls illustrated in http://www.mvps.org/access/api/api0054.htm at
"The Access Web".

Yes, it looks intimidating. However, all you need to do is copy everything
between Code Start and Code End and paste it into a new module (not a class
module nor a module associated with a form or report). When you save the
module, do not name it the same as any of the functions or subs within it.
To be save, call it something like mdlFolders.

Once you've done that, all you need to do to get the My Documents folder,
you'd use fGetSpecialFolderLocation(CSIDL_PERSONAL)
 
Back
Top