Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jrwaguespack
 
Posts: n/a
Default Importing Microsoft Word File Names

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   Report Post  
Harald Staff
 
Posts: n/a
Default

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   Report Post  
jrwaguespack
 
Posts: n/a
Default

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   Report Post  
Harald Staff
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing .txt data files increases .xls file size BrianJ Excel Discussion (Misc queries) 1 January 29th 05 02:02 PM
Weekly Transaction Processing Ralph Howarth Excel Worksheet Functions 4 January 19th 05 05:37 AM
How do I import Microsoft Word files into Microsoft Excel? Excel New Users to Excel 1 January 9th 05 01:03 AM
S.O.S :importing excell data into word villi Excel Discussion (Misc queries) 0 November 25th 04 08:37 PM
Import file names into cells craigwojo Excel Worksheet Functions 2 November 2nd 04 11:19 PM


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"