Option Explicit
Sub X()
' constants
Const ksFolder = "C:UsersAnonymousDesktop"
Const ksExtensions = "*.*"
' declarations
Dim I As Integer, A As String
' start
Range("A:A").ClearContents
I = 0
A = Dir(ksFolder & Application.PathSeparator & ksExtensions)
' process
Do Until A = ""
I = I + 1
ActiveSheet.Cells(I, 1).Value = A
A = Dir()
Loop
' end
End Sub
Option Explicit
Sub X()
' constants
Dim desktoploc As String
desktoploc = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "Exported Data"
' Const ksFolder = "desktoploc"
Const ksExtensions = "*.*"
' declarations
Dim I As Integer, A As String
' start
Range("A:A").ClearContents
I = 0
A = Dir(desktoploc & Application.PathSeparator & ksExtensions)
' process
Do Until A = ""
I = I + 1
ActiveSheet.Cells(I, 1).Value = A
A = Dir()
Loop
' end
End Sub