I have a word document contained two tables.
One table (Table 0) is located in the document header consists of two column and 3 rows, the number of rows and columns are FIXED.
Another table (Table 1) is located in the document body where data from Access recordsets will be filled via vba like code below:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim wd As Object
Dim fld As Field
Dim iRow As Integer
Dim iCol As Integer
Dim iTbl As Integer
Set wd = CreateObject("Word.Applica
Set mydoc = wd.Documents.Open("C:\Samp
Set db = CurrentDb()
' ** Starts Filling In Field Data into Table 1 Located in Document Body **
Set rs = db.OpenRecordset("MyRecord
iTbl = 1 'Existing table number in Word document body
iRow = 1 'Starting row in table
wd.Visible = True
Do Until rs.EOF
If iRow > mydoc.tables(iTbl).Rows.Co
For Each fld In rs.Fields
iCol = iCol + 1
ow, iCol).Range.Text = Nz(fld.Value)
iRow = iRow + 1
iCol = 0
Set rs = Nothing
Set mydoc = Nothing
Set wd = Nothing
My question is how do I programmatically add text to rows of Table 0 located in Document Header before the transfer of recordsets into Table 1?
Attached is the graphical explanation of the sample document, the gray lined table represent Table 0 located in document header.
Thanks in advance.