Hi all,
I'm quite a newbee, so please excuse me if I ask something that's very
obvious to you ;-)
Right now I've made a Word-template, in which data is retrieved from an
Access database using ADODB. The queries are defined in Word, and this is not
the best way.
Better would be if the Word-template uses queries defined in the Access
database, and that the Word template itself was called from within Access (by
a commandbutton on a form). Is there a way of doing this?
Another possibility could be that with a commandbutton_click, a new Word
document is made, based on the existing Word template; how would I do this?
BTW: I'm using Office XP.
Thanks in advance! Any help much appreciated!
Cheerio,
Fr@nk
Ofer - 18 Jul 2005 14:57 GMT
Search the post "Export current record to word", there is an example how to
use word with bookmarks
==================================================
Create A word document, insert book marks where you want the value from
access should be insert, and then run this code
Public Sub PrintToWord()
Dim wd As Word.Application
Dim myDoc As Word.Document
Set wd = New Word.Application
wd.Documents.Add DOTpath & reportName & ".dot" ' The name and path
Set myDoc = wd.ActiveDocument
With wd.Selection
.GoTo wdGoToBookmark, Name:=BookMarkName ' The name of the book
mark
.Font.Bold = True ' You can choose if bold
.Font.Underline = False ' or underline
.TypeText Text:=ValueToInsertInTheBookMark ' insert values
End With
wd.Visible = True
End Sub
> Hi all,
>
[quoted text clipped - 18 lines]
>
> Fr@nk
Albert D.Kallal - 18 Jul 2005 15:53 GMT
I have a nice sample working that allows you to merge the current record to
word, and much much more.
Try downloading the sample here:
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal