![]() ![]() ReDim Preserve flNames(UBound(flNames) + 1)įlNames(UBound(flNames)) = Folder & vbTab & _ĪFile.Name & vbTab & aFile.Size & vbTab & aFile. Selection.ConvertToTable Separator:=wdSeparateByTabs, AutoFitBehavior:=wdAutoFitFixed "Size" & vbTab & "Creation Date" & vbCrLf ![]() Selection.TypeText "Path" & vbTab & "File name" & vbTab & _ Set FileSystem = CreateObject("Scripting.FileSystemObject") When you see the list of files, click Transform Data. Browse to the folder that contains the folders you want a list of, and then click Open. Open your spreadsheet program (or word processor), paste (Ctrl+V) the list to it and adjust the width of the column. Hold down the Shift key, right-click on the selection and choose Copy as Path. ' ***** This declaration must be at the top of the module ***** To display the contents of a folder open Windows Explorer, navigate to the source folder and press Ctrl+A to select all the items. Word’s Sort can then be used to sort into any order. The results are put into a table in a new document. Other file information could be shown by changing the statement flNames(UBound(flNames)) = … The detail given for each file is the path, the name, the size and the creation date. The following macro will produce a list of all files in a folder and its sub-folders. The solution shown will give a list of files in a folder but not its sub folders. There are also third-party solutions available, such as Karen's Directory Printer, which was suggested by more than one subscriber: If you are looking for a more traditional way of getting the list using the command prompt or a macro, you should consider the WordTip located at this URL: ![]() For instance, you might want to select what was pasted and use Find and Replace to modify the path to each file, as desired. You can then edit the list in any way desired. What you end up with is the list of files-including full path names-in your document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |