To get the path to the users desktop, use:
PathToDesktop = Environ("USERPROFILE") & "\Desktop"
Question
I have a small program that creates a load of files and saves to a folder specified by the user. Currently the top of the userform
looks like the following when initialised:
I'd prefer if when the userform opens and also when the dialog for choosing a appears (via the Destination button) that a general default is already shown:
Can the program find the pathway to a user's desktop?
Solution
To get the path to the users desktop, use:
PathToDesktop = Environ("USERPROFILE") & "\Desktop"
OTHER TIPS
If you are doing this in excel-vba, the following code would save the current workbook as a copy to the user's desktop... you can probably figure out what you're doing from there.
Dim DesktopPath As String
DesktopPath = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
ActiveWorkbook.SaveAs DesktopPath & "filename.xls"