Bookmark insert table issue (1 Viewer)

aman

Registered User.
Local time
Today, 03:29
Joined
Oct 16, 2008
Messages
1,250
Hi guys

I am writing the following code to insert a table in word document using access vba . I want to display 2 columns in a table i.e assessment questions and the scoring against each question . My code displays the assessment questions in the table but scoring doesn't get displayed. Any help will be much appreciated .
Code:
Set bk=wd.Bookmarks("InsertTable")
Set wt=wd.tables.add(bk.range,1,2)
Wt.columns(1).width=400
wt.columns(2).width=50

Do until .eof

Msgbox .fields(1)
Set wr=wt.rows.add
Wr.cells(1).range.text=.fields(0)
Wr.cells(2).range.text=.fields(1)
.movenext
Loop

The above code displays the scoring of each assessment question in the message box but doesn't show it on word document . I have made sure that that the bookmark exists in the word document .
Please can anyone help me in this ?
Thanks
 

Cronk

Registered User.
Local time
Today, 20:29
Joined
Jul 4, 2013
Messages
2,772
The extract of code looks OK. Can you include the declaration statements and the line(s) opening up the recordset.

In test phase, I make the document visible and step through the relevant code to ensure word is doing what I want it to.
 

Users who are viewing this thread

Top Bottom