This is code that I use to export to Word:
Sub PatientForm()
Dim appWord As Word.Application
Dim doc As Word.Document
Dim objWord As Object
On Error Resume Next
err.Clear
Set appWord = GetObject(, "Word.Application")
Set objWord = CreateObject("Word.Application")
If err.Number <> 0 Then
objWord.Documents.Open CurrentProject.Path & "\test.doc"
objWord.Visible = True
End If
'Set doc = appWord.Documents.Open("C:\PatientForm.doc", , True)
Set doc = appWord.Documents.Open(CurrentProject.Path &
"\MontefioreRADON.doc", , True)
With doc
.FormFields("Back").Result = [Forms]![Patient]![Back]
.FormFields("Neck").Result = [Forms]![Patient]![Neck]
.FormFields("Head").Result = [Forms]![Patient]![Head]
.FormFields("Arms").Result = [Forms]![Patient]![Arms]
.FormFields("Legs").Result = [Forms]![Patient]![Legs]
.FormFields("ReversedTable").Result = [Forms]![Patient]![ReversedTable]
.FormFields("Other").Result = [Forms]![Patient]![Other]
' If .FormFields("Text1").Result <> "" Then _
' vRecordSet("Company Name") = .FormFields("Text1").Result
.Visible = True
.Activate
End With
Set doc = Nothing
Set appWord = Nothing
Exit Sub
errHandler:
MsgBox err.Number & ": " & err.Description
End Sub
Finally, u8ndet Tools > References > Make sure the appropriate Microsoft
Word xxx Object Library is checked.
Finally, why not use a Report. This is similar, but different, from a Word
document. Quite different actually, but when you print hard copies, an
Access Report is completely indistinguishable from a Word Document.
HTH,
Ryan--
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
José António Silva said:
Having distributed an access application with the Access 2007 run time, I
notice now that the button “Export to Word†is disabled. However, in my
computer, where I have the full Access version this button is available. Why
is this happening? Is something missing in client machines? This also happens
in a machine with word 2007 installed (i.e., standard office).
Thanks,
José António Silva