Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default for each doc in dir, copy data to excel

Hello there,

I have a directory full of word docs.

Each doc contains just name and address.

Each doc was used to print an address label for a parcel.

I need to get the name and address from each file, together with the date
the file was created.

This will provide a record in Excel of when each parcel was prepared for
dispatch.

I'm 99% sure this can be done with an Excel VBA routine, but I don't have
the skill to write it myself.

If anyone can help, Ill be most grateful indeed.

Max

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default for each doc in dir, copy data to excel

Max,
In psuedo-code, something like:
'Make a reference to the Word type library
'in VBEToolsreferences

Dim Filename As String
Dim FileCount As Long
Dim WordApp As word.Application
Dim WordDoc As word.document

filename=dir(<path to the folder & "\*.doc")
Set WordApp = New word.Application

With Worksheets("data").Range("a1")
Do While Filename < ""
FileCount = FileCount + 1
set worddoc=wordapp.documents.open(<path to the folder & "\" &
filename)

.offset(filecount,0)=worddoc.<name data
.offset(filecount,1)=worddoc.<address data
.offset(filecount,2)=filedatetime(<path to the folder & "\" &
filename)

WordDoc.Close
Loop
End With

WordApp.Quit

You can record a macro in Word to see the syntax of getting the name and
address data.

NickHK

"Max Bialystock" wrote in message
...
Hello there,

I have a directory full of word docs.

Each doc contains just name and address.

Each doc was used to print an address label for a parcel.

I need to get the name and address from each file, together with the date
the file was created.

This will provide a record in Excel of when each parcel was prepared for
dispatch.

I'm 99% sure this can be done with an Excel VBA routine, but I don't have
the skill to write it myself.

If anyone can help, Ill be most grateful indeed.

Max



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
Excel copy data Paul Gardiner Excel Worksheet Functions 2 October 15th 09 05:17 AM
How copy none excel data & paste in 2007 without overwriting data Wakefootin Excel Discussion (Misc queries) 2 October 8th 09 12:15 AM
Copy excel data (inc. textbox data) into Word Sarah (OGI) Excel Discussion (Misc queries) 0 August 14th 07 05:00 PM
MFC - CopyFromRecordset - Copy data to Excel Jen Leonard Excel Programming 0 June 7th 06 03:01 AM
Copy data from IE to Excel Maxi[_2_] Excel Programming 0 March 7th 06 03:42 PM


All times are GMT +1. The time now is 10:47 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"