Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I have a file in Microsoft Word that has over 5,000 Word Documents in it. I
want to copy only the filenames into an Excel Spreadsheet, so that I will have a list of all of the documents in an Excel Spreadsheet. If anyone has any guidance, it would be greatly appreciated. |
#2
![]() |
|||
|
|||
![]()
Hi
Open the VB editor in Excel (F11 or similar). Insert Module. Paste this into it: '***************** start *********************** Sub Test() Call ListWordFiles("C:\Temp") End Sub Sub ListWordFiles(Folder As String) Dim NextFile As String Dim L As Long On Error Resume Next NextFile = Dir(Folder & "\*.do*") Do Until NextFile = "" L = L + 1 Cells(L, 1) = Folder & "\" & NextFile ActiveSheet.Hyperlinks.Add _ anchor:=Cells(L, 1), _ Address:=Folder & "\" & NextFile Cells(L, 2) = FileDateTime(Folder & "\" & NextFile) NextFile = Dir() Loop End Sub '********************* end ******************* Change the text "C:\Temp" to your real folder name. Return to Excel and run the macro Test. HTH. Best wishes Harald "jrwaguespack" skrev i melding ... I have a file in Microsoft Word that has over 5,000 Word Documents in it. I want to copy only the filenames into an Excel Spreadsheet, so that I will have a list of all of the documents in an Excel Spreadsheet. If anyone has any guidance, it would be greatly appreciated. |
#3
![]() |
|||
|
|||
![]()
Nothing Happened. Do I need to insert the ****start*** and ***end*** line as
well? "Harald Staff" wrote: Hi Open the VB editor in Excel (F11 or similar). Insert Module. Paste this into it: '***************** start *********************** Sub Test() Call ListWordFiles("C:\Temp") End Sub Sub ListWordFiles(Folder As String) Dim NextFile As String Dim L As Long On Error Resume Next NextFile = Dir(Folder & "\*.do*") Do Until NextFile = "" L = L + 1 Cells(L, 1) = Folder & "\" & NextFile ActiveSheet.Hyperlinks.Add _ anchor:=Cells(L, 1), _ Address:=Folder & "\" & NextFile Cells(L, 2) = FileDateTime(Folder & "\" & NextFile) NextFile = Dir() Loop End Sub '********************* end ******************* Change the text "C:\Temp" to your real folder name. Return to Excel and run the macro Test. HTH. Best wishes Harald "jrwaguespack" skrev i melding ... I have a file in Microsoft Word that has over 5,000 Word Documents in it. I want to copy only the filenames into an Excel Spreadsheet, so that I will have a list of all of the documents in an Excel Spreadsheet. If anyone has any guidance, it would be greatly appreciated. |
#4
![]() |
|||
|
|||
![]()
Those lines would make no difference. Please explain what you did and post
your "Test" macro. Best wishes Harald "jrwaguespack" skrev i melding ... Nothing Happened. Do I need to insert the ****start*** and ***end*** line as well? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Importing .txt data files increases .xls file size | Excel Discussion (Misc queries) | |||
Weekly Transaction Processing | Excel Worksheet Functions | |||
How do I import Microsoft Word files into Microsoft Excel? | New Users to Excel | |||
S.O.S :importing excell data into word | Excel Discussion (Misc queries) | |||
Import file names into cells | Excel Worksheet Functions |