Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies. Only from Platform Scholar.
Sub GetFileNames() Dim iRow As Integer Dim strDirectory As String, strFName As String, strInitialFoldr As String iRow = 1 Range("A1").Activate With Application.FileDialog(msoFileDialogFolderPicker) .Show strDirectory = .SelectedItems(1) & "\" strInitialFoldr = strDirectory End With With Application.FileDialog(msoFileDialogFolderPicker) .Title = "Now….Please select a *Folder* to list Files from" .InitialFileName = strInitialFoldr .Show If .SelectedItems.Count <> 0 Then strDirectory = .SelectedItems(1) & "\" strFName = Dir(strDirectory, 16) Do While strFName <> "" ActiveCell.Offset(iRow) = strFName iRow = iRow + 1 strFName = Dir Loop Range("A1") = strDirectory ActiveWindow.DisplayGridlines = False Range("A1").EntireColumn.AutoFit End If End With End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.