Sohaila Taravati
11-28-2001, 04:48 PM
I have this database for our claims department. The person that is using it has a lot of letters she sends to customers. She basically uses templates for her Word documents and just changes around the figures and other things that she wants. I have taken these templates and tried making them in Access, so all she has to do is to just take the report to the word and do her changes. I have looked in the forum and I know that formatting changes when a report is taken form access to word. I also know you can take a snapshot of a report. Just want to know if there is any other way this could be done, so she can change her documents and not have a messed up formatting. Thanks in advance http://www.access-programmers.co.uk/ubb/smile.gif
jwindon
11-29-2001, 04:56 AM
You could use some code to open up a Word document and "plug in" the data where needed. Play around with this code below.
Dim dbs As DAO.Database
Dim rstMergeThese As Recordset
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
With oApp
.Documents.Open "C:\My Documents\DataMailMerge.doc"
' Move to each bookmark and insert text from the form.
.ActiveDocument.bookmarks("FirstName").Select
.selection.Text = (CStr(Forms!frmForm1!FirstName))
.ActiveDocument.bookmarks("LastName").Select
.selection.Text = (CStr(Forms!frmForm1!LastName))
'if word isn't running, start and activate it
If Err Then
Shell "C:\Program Files\Microsoft Office\Office\" & "WinWord / Automation", vbMaximizedFocus
AppActivate "Microsoft Word"
End If
Set oApp = Nothing
End With
End Sub