Search code examples
vbaexceluserformfilesystemobject

Use a generic pathway as default


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:

enter image description here

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:

enter image description here

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"