Determining User in Documents and Setting folder, create and write to it

  • Thread starter Thread starter Robb
  • Start date Start date
R

Robb

I have an app that we are upgrading and one of the upgrades is to
avoid writing to the Registry. We previously created and used 4 keys
there. I have updated the software (Access2k) to avoid using 3 of the
4. The 4th previously consisted of having the user create a folder
(C:\Retrieve). My users will not have Administrative priviledge so
this is no longer an option.

Now I would like to, upon initial installation or use of the software
to:
1. Determine user name. For example- "C:\Documents and Settings\lahsr"
2. Create a folder named "Retrieve" in that user's Application Data
folder
3. Write to that folder (basically we are retrieving databases and
archiving them here.

Not sure if using an INI file will be of any help (co worker mentioned
it)

Any help/suggestions will be greatly appreciated.

Thanks,
Robb
 
This works for me for determining the user name:

How to Retrieve Workgroup Information Under Win32
http://support.microsoft.com/?id=210088

You could then do something like
On Error Resume Next
MkDir ("C:\Documents and Settings\" & username & "\Retrieve")

or you might want to trap for run-time error 75 instead of resume next. I get run-time
error 75 if the folder already exists.

Note: I think you'll be able to use the MkDir statement without any problems, but just in
case, you might want to check out the "Sandbox" settings:

http://support.microsoft.com/?id=239482


Tom

_______________________________________


I have an app that we are upgrading and one of the upgrades is to
avoid writing to the Registry. We previously created and used 4 keys
there. I have updated the software (Access2k) to avoid using 3 of the
4. The 4th previously consisted of having the user create a folder
(C:\Retrieve). My users will not have Administrative priviledge so
this is no longer an option.

Now I would like to, upon initial installation or use of the software
to:
1. Determine user name. For example- "C:\Documents and Settings\lahsr"
2. Create a folder named "Retrieve" in that user's Application Data
folder
3. Write to that folder (basically we are retrieving databases and
archiving them here.

Not sure if using an INI file will be of any help (co worker mentioned
it)

Any help/suggestions will be greatly appreciated.

Thanks,
Robb
 
Tom,
Thanks, that did the trick...successfully implemented it over the
weekend. Much appreciated.

Happy Holidays!

Robb
 
Back
Top