Desktop path?

C

Charlotte E.

I have Excel create a report (a .TXT-file) via VBA, and that part works fine
:)

But now I would like Excel to automatically save this report on the users
desktop for easy access, everytime the user runs the macro.

But being in a multinational company the name and path of the users desktop
can be very different!

I've tried to see if there's an ENV-variable, telling me the current
desktop-path, but I couldn't find it, so...


....is there a way to find the current desktop path in VBA???


TIA,
 
D

Dave Peterson

Dim myPath As String
myPath = CreateObject("WScript.Shell").SpecialFolders("DeskTop")
MsgBox myPath
 
G

Gary Keramidas

if you want to try the environment variable route, this may work. works in
english versions xp and vista. i think some have reported issues, but i've
never seen them.

environ("USERPROFILE") & "\Desktop\"
 

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