View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
s[_2_] s[_2_] is offline
external usenet poster
 
Posts: 41
Default inserting table data from a Word document into an Access table

On May 30, 1:16*am, "Graham Mayor" wrote:
I don't know much about programming Access tables, but the extraction of the
data from the last column of the tables (no matter how many and how
organised) is simple enough. The following will do that - and here displays
them table by table in a message box. Replace that message box with the
commands to send the content to your Access cell.

Dim oTable As Table
Dim oRow As Row
Dim oRng As Range
Dim sText As String
For Each oTable In ActiveDocument.Tables
* * sText = ""
* * For Each oRow In oTable.Rows
* * * * If oRow.Cells.Count 1 Then
* * * * * * Set oRng = oRow.Cells(oRow.Cells.Count).Range
* * * * * * oRng.End = oRng.End - 1
* * * * * * sText = sText & oRng.Text & Chr(44)
* * * * End If
* * Next oRow
* * sText = Left(sText, Len(sText) - 1)
* * MsgBox sText
* * 'Insert sText into your table as required
Next oTable

Thanks, that is very helpful. But, in the Message Box I cannot see all
the contents
of all the columns of all tables in the document. I gather the CString
variable
should be able to store around 2^31 characters as it is a variable
string so it should
have enough capacity

Or, am I missing something else?

Thanks