boa noite, precisaria colocar dentro de "Do While Not rs.EOF
" que os campos(admissao, demissao, empresa e profissao) ficassem em colunas, obrigado...
On Error GoTo MergeButton_Err
Dim objWord As Word.Application, rs As Recordset
Set rs = CurrentDb.OpenRecordset("tb_carteiratrabalho")
'Copy the Photo control on the Employees form.
DoCmd.GoToControl "reclamante"
DoCmd.RunCommand acCmdCopy
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("C:\Documents and Settings\Claudio\Meus documentos\PericiaMédica\modelopm.doc")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("reclamante").Select
.Selection.Text = (CStr(rs!Reclamante))
.ActiveDocument.Bookmarks("reclamante2").Select
.Selection.Text = (CStr(rs!Reclamante))
Do While Not rs.EOF
.ActiveDocument.Bookmarks("admissao").Select
.Selection.Text = (CStr(rs!Admissao))
.ActiveDocument.Bookmarks("demissao").Select
.Selection.Text = (CStr(rs!Demissao))
.ActiveDocument.Bookmarks("empresa").Select
.Selection.Text = (CStr(rs!Empresa))
.ActiveDocument.Bookmarks("profissao").Select
.Selection.Text = (CStr(rs!Profissao))
rs.MoveNext
Loop
End With
'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
objWord.ActiveDocument.PrintOut Background:=False
'Close the document without saving changes.
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
'Quit Microsoft Word and release the object variable.
objWord.Quit
Set objWord = Nothing
Exit Sub
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
'If the x field is empty.
ElseIf Err.Number = 2046 Then
MsgBox "Please add a x to this record and try again."
Else
MsgBox Err.Number & vbCr & Err.Description
End If
Exit Sub
End Sub