Bryan Carbonnell
carbonnb at sympatico.ca
Wed Jan 4 18:46:29 CST 2006
Should have gone to the list too.
Bryan
------- Forwarded message follows -------
On 5 Jan 2006 at 11:08, Michael Maddison wrote:
> I've been asked how much $$$ to extract data from a series of word docs.
> Each record is made up
> of 3 docs. There are 80 records (240 docs). The docs are quite large
> 20+ pages each, with questions
> and either ticks or X's in a tabular format. There are no fields.
> I've never done this so my question is how easy is it to code something
> like this or should I just
> employ a temp to slog through it?
It depends. Are all the docs the same format? The same number of
tables, columns, rows, etc? Is the marking consistant to indicate the
choice?
If the answer is yes, then it should be fairly straight forward. Here
is some code (written in Word, so you will have to translate into
Access :)to give you an idea of what would be involved in reading the
cells.
Sub test()
Dim doc As Document
Dim tbl As Table
Dim lngRow As Long
Dim lngRowCount As Long
Dim strCol2 As String
Dim strCol3 As String
Dim bolYes As Boolean
Dim bolNo As Boolean
Set doc = ActiveDocument
Set tbl = doc.Tables(1)
lngRowCount = tbl.Rows.Count
lngRow = 1
Do While lngRow <= lngRowCount
'Get the values in the "choice" columns
strCol2 = tbl.Cell(lngRow, 2).Range
strCol3 = tbl.Cell(lngRow, 3).Range
'Strip the trailing 2 characters asc(7) & asc(13)
If Len(strCol2) > 2 Then
strCol2 = Left$(strCol2, 1)
Else
strCol2 = ""
End If
If Len(strCol3) > 2 Then
strCol3 = Left$(strCol3, 1)
Else
strCol3 = ""
End If
'Check to see if first "choice" column is "checked"
If LCase(strCol2) = "x" Then
bolYes = True
End If
'Check to see if second "choice" column is "checked"
If LCase(strCol3) = "x" Then
bolNo = True
End If
'Store the Values in your table
'reset flags
bolYes = False
bolNo = False
'increment row counter
lngRow = lngRow + 1
Loop
Set tbl = Nothing
Set doc = Nothing
End Sub
A couple of assumptions here:
This is a single table with a minimum or 3 columns, where the choices
are in columns 2 & 3 which are all marked with an x (upper or
lowercase doesn't matter)
HTH,
--
Bryan Carbonnell - carbonnb at sympatico.ca
Earth is the insane asylum for the universe.
------- End of forwarded message -------
--
Bryan Carbonnell - carbonnb at sympatico.ca
Needing someone is like needing a parachute. If he isn't there the first time, chances are you won't be needing him again.