Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 11-07-2013, 05:02 AM
iliauk iliauk is offline How to Extract key data from word Windows 7 32bit How to Extract key data from word Office 2010 32bit
Novice
How to Extract key data from word
 
Join Date: Nov 2013
Posts: 1
iliauk is on a distinguished road
Default How to Extract key data from word

Hi,

I have a bunch of word documents/forms/questionnaires coming in and I would like to find a way to automate the extraction of several fields such as Name, Email, Company etc.

Unfortunately, the document wasn't created with this in mind so it doesn't have clear forms for the data-entered, e.g.

1. Company
Please indicate the company and provide contact details for the signatory on the contract.



Thanks very much.

Edit:

I tried a macro like this:

Sub DataExtract()
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oCell As Word.Cell
Dim sPath As String
Dim sFile As String
Dim r As Long
Dim c As Long
Dim Cnt As Long

Application.ScreenUpdating = False

Set oWord = CreateObject("Word.Application")

sPath = "H:\WordAccess" 'change the path accordingly

If Right(sPath, 1) <> "\" Then sPath = sPath & "\"

sFile = Dir(sPath & "*.doc")

r = 2 'starting row
c = 1 'starting column
Cnt = 0
Do While Len(sFile) > 0
Cnt = Cnt + 1
Set oDoc = oWord.Documents.Open(sPath & sFile)
For Each oCell In oDoc.Tables(1).Range.Cells
Cells(r, c).Value = Replace(oCell.Range.Text, Chr(13) & Chr(7), "")


c = c + 1
Next oCell
oDoc.Close SaveChanges:=False
r = r + 1
c = 1
sFile = Dir
Loop

Application.ScreenUpdating = True

If Cnt = 0 Then
MsgBox "No Word documents were found...", vbExclamation
End If

End Sub

However it only extracts one of the tables in the document and I'm not sure how to customise that to the data I need.
  #2  
Old 11-07-2013, 10:22 PM
macropod's Avatar
macropod macropod is offline How to Extract key data from word Windows 7 32bit How to Extract key data from word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Cross-posted at: http://www.excelforum.com/word-progr...ml#post3468083
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #3  
Old 11-08-2013, 12:43 AM
eNGiNe eNGiNe is offline How to Extract key data from word Windows 7 32bit How to Extract key data from word Office 2010 64bit
Expert
 
Join Date: Jan 2012
Location: Brussels [BE]
Posts: 746
eNGiNe is on a distinguished road
Default

How about, speculatively …
  1. setting a style for labels/comments
  2. using Find/replace to apply that style to all this non-content
  3. using Find to pull out all the real content, which you can now identify because it's not using your new :labels style
You could also try a variant with two styles, one for labels such as "company" and another for handholding such as "please provide the name of the company", discard the non-content, change the paragraph mark after each label to a tab, copy/paste into a spreadsheet …

Of course, I haven't had the time to create a dummy questionnaire and test these ideas <g>
  #4  
Old 11-08-2013, 04:37 PM
macropod's Avatar
macropod macropod is offline How to Extract key data from word Windows 7 32bit How to Extract key data from word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Subsequently also cross posted at: http://www.vbaexpress.com/forum/show...ent-into-excel - and still no regard for the etiquette. Thread closed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to extract various text in Word? barnkeeper410 Word 4 07-08-2013 10:58 PM
How to Extract key data from word VBA code to extract specific bookmarks from multiple word files Rattykins Word VBA 4 06-27-2012 10:02 PM
How to Extract key data from word Extract phone number from word file donlincolnmsof Word VBA 12 06-19-2012 05:21 PM
Can I Extract a Page from Word and Make a New DOCX File? tatihulot Word 1 06-20-2010 11:38 PM
Extract Photographs The Gap PowerPoint 4 04-22-2010 07:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft