![]() |
|
|
|
#1
|
|||
|
|||
|
Want to prepare an index file of a folder's file names. MS Word 2010. Faint memory of doing this but can't remember steps. Thanks for help.
Bob Last edited by Charles Kenyon; 05-19-2016 at 09:14 AM. Reason: Mark as solved |
|
#2
|
||||
|
||||
|
Perhaps the simplest solution is the Printfolders utility which you can download from my web site - http://www.gmayor.com/downloads.htm
Alternatively you could use a macro. The following is the most basic Code:
Option Explicit
Sub ListFiles()
Dim strFile As String
Const strPath As String = "C:\Path\" 'The folder to process
Dim strList As String
strFile = Dir$(strPath & "*.*")
While strFile <> ""
strList = strList & strFile & vbCr
strFile = Dir$()
Wend
strList = Left(strList, Len(strList) - 1)
Selection.Text = strList
lbl_Exit:
Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Thank you, Graham, for your answers.
I will probably be back for more help on similar problems. Am long time casual user of Word - not enough use to become "expert". |
|
| Tags |
| index |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Copy and Paste from File to File but File Names always change
|
aaronbauer1980 | Excel Programming | 1 | 04-15-2016 05:53 PM |
Automated file names
|
Gary Drumm | Word | 3 | 04-17-2013 11:30 AM |
| Add text to all file names in folder | cure4glass | Office | 3 | 04-06-2012 04:23 PM |
| capture sender's contact to 'Contacts Folder' | gianimpact | Outlook | 0 | 02-09-2010 07:56 AM |
| Two Different Names in the Same File | kathy carson | Outlook | 0 | 02-14-2006 01:02 PM |