-----Original Message-----
Dear Friends
How to send data from a form (or query) to MS Word using
vba code.
I want to control MS Word from MS Access
Thank you in advance
Konrad
Hi Konrad,
to use early binding you must first have a reference to
the ms word object library. In the vbe use
tools|references.
use the following as an example for referencing ms word.
dim wdApp as Word.Application
dim wdDoc as Word.Document
dim wdRange as Word.Range
on error resume next
' try to reference an open word session
set wdApp = GetObject(,"Word.Application")
if err.number<>0 then
' word not already open
set wdApp=new word.application
end if
set wdDoc=wdApp.Documents.Add
' to see document
wdApp.visible=true
' set range to end of document contents
set wdRange=wdDoc.Bookmarks("\EndOfDoc").Range
' insert at range value in form textbox combined with a
new line
wdRange.Text=txt.value & vbnewline
hope above helps.
For further help with manipulating ms word I recommend the
word usergroups. Also use the object browser to lookup
word range object.
Luck
Jonathan