Generate files with a button and write them to active desktop.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there. I have a database with some tables and a form.
On the form is a button that initializes a programme to export data to a
location.

Currently I'm the only one using the database, but now somebody else will
start using it. The code behind the button has an absolute output-location to
my desktop now:
"C:\Documents and Settings\Dear-John\Desktop\"

I would like to change the code so it will always write the files to the
desktop of the current user of the programme.

I have tried already with:
"C:\Documents and Settings\%userprofile%\Desktop\"
"C:\%userprofile%\Desktop\"
"%userprofile%\Desktop\"

But so far... no luck.

Can anyone help me with the correct code?
 
Try this:

Dim UserDesktop As String
UserDesktop = Environ$("userprofile") & "\Desktop"
MsgBox UserDesktop


HTH
 
Back
Top