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

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?
 
G

Guest

Try this:

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


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top