Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.tables
|
|||
|
|||
![]()
Yes, but how would the location be determined?
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Marco Napoli" wrote in message ... Is there a way to choose a place to add a Table by code without using Bookmarks? -- Peace in Christ Marco Napoli http://www.ourlovingmother.org "Doug Robbins - Word MVP" wrote in message ... Use a Catalog or in Word XP and later, it is calle Directory, type mail merge. Here is how you would create a table in a document and insert the data from an Access table into the rows of that table: Dim myDataBase As Database Dim myActiveRecord As Recordset Dim i As Long Dim dtable As Table, drow As Row 'Open a database Set myDataBase = OpenDatabase("c:\Access\Procurement Plan.mdb") 'Access the first record from a particular table Set myActiveRecord = myDataBase.OpenRecordset("Currencies", dbOpenForwardOnly) 'Add a table to the document with one row and as many fields as there are in the database table Set dtable = ActiveDocument.Tables.Add(Range:=Selection.Range, NumRows:=1, numcolumns:=myActiveRecord.Fields.Count) Set drow = dtable.Rows(1) 'Loop through all the records in the table until the end-of-file marker is reached Do While Not myActiveRecord.EOF 'Populate the cells in the Word table with the data from the current record For i = 1 To myActiveRecord.Fields.Count drow.Cells(i).Range.Text = myActiveRecord.Fields(i - 1) Next i 'Add a new row to the Word table and access the next record Set drow = dtable.Rows.Add myActiveRecord.MoveNext Loop 'The last row will be empty, so delete it drow.Delete 'Then close the database myActiveRecord.Close myDataBase.Close -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Romine" wrote in message oups.com... I am importing data from an AS/400 using OLE DB/ADO and wish to populate a table with data. I am reading a Primary file which has header information, and I need to load detail from two additional files into the Table. The number of rows within the table must be variable. I would like to control loading the table by cell. For example, load Name in Row 1, Column 1, Amount #1 in Row 1, Column 2, Amount #2 in Row 1, Column 3, Total in Row 1, Column 4....then read the next record and start loading in Row 2...and so on. So, my question is this; How do I load data into cells of a table and allow the table to be a variable length? Thanks, Romine |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
want cells in a table to copy data from cells in another table | Tables | |||
MS Word: select cells range and duplicate same data in all cells | Microsoft Word Help | |||
Pasting the Same Data into multiple cells of a table | Tables | |||
Table Cells act as if there is more info to the right of the data | Tables | |||
Automatic calculation as data is entered into table cells | Microsoft Word Help |