The simplest way is to use
Environ
,
ChDrive
and
ChDir
function.
Dim sUserPath As String, sDefaultPath
sDefaultPath = Application.DefaultFilePath
sUserPath = Environ("USERPROFILE") & "My Documents\"
Application.DefaultFilePath = sUserPath
Application.DefaultFilePath = sDefaultPath
How to get
MyDocuments
folder using other methods? Please, see:
Get the Path to My Documents in VBA[
^]