Inserting a footnote into Word doc from Access



Hello, I am fairly new to Access databases and programming with VBA. However,
my problem is this:

I have a database in which I write information to a word document table
using fields. The table size is variable so I have code which copies and
pastes the rows of the table and updates the fields as required. In the
bottom row of the table, using VBA code in Access I select the single cell I
would like to add a footnote too. The code I have for that is this;

where cellcounter indicates the particular I am selecting. When the word
opens the correct cell and field text is selected.

'This is how I create my word document
Dim wordApp2 As New Word.Application
Dim docs2 As Word.Documents
Dim doc2 As Word.Document

Set docs = wordApp.Documents
'Telling to write the records to the Report in the templates folder
Set doc = docs.ADD(strTemplateDir & "rpt_Select" & "8" & ".dot")
Dim props As Object

Set props = doc.CustomDocumentProperties
Set wordAppForQuit = wordApp

'This is the code that is supposed to insert the footnote every time
With wordApp
.Selection.Tables(1).Cell(cellcounter, 1).Select

.Visible = True
ActiveDocument.Footnotes.ADD Range:=Selection.Range, _
text:="refers to total number of recognized labs"

End With

My issue is this, when I open up the Access application to generate the
report with
the footnote, the first time I generate the Word report the footnote is
successfully placed. However, once I close the word report without closing
the Access application and try to generate the report again, the report
prints fine but returns an error when inserting the footnote. The footnote is
not inserted. When I close the entire Access database and reopen it, it
successfully inserts the footnote the first time around but returns an error
and does not insert the footnote in the word document any time after the
first time until I close and reopen Access again.

I am using MS Office 2003 and do not really know where to start to solve
this issue, any suggestions or recommendations would be highly appreciated
and helpful.

Larry Daugherty

Had I been aware that there were two identical posts on this issue I
wouldn't have answered either one.

A little patience is always in order. See and
look for "netiquette"


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question