Get the Windows Download folder's path

后端 未结 4 1085
失恋的感觉
失恋的感觉 2021-01-05 05:24

I have some Excel VBA code that requires knowing the Downloads folder path. How could I do it?

Since you can move around the Downloads folder (and

4条回答
  •  不知归路
    2021-01-05 05:56

    Sub GetDownloadedFolderFiles()
    '
    ' Keep it simple - Paul Seré
    '
    Dim fso  As New FileSystemObject
    Dim flds As Folders
    Dim fls  As Files
    Dim f    As File
    
    'Downloads folder for the actual user!
    
    Set fls = fso.GetFolder("C:\Users\User\Downloads").Files 
    
    For Each f In fls
        Debug.Print f.Name
    Next
    
    End Sub
    

提交回复
热议问题