Thanks Brendan The complete sub is below. I'm using version Office XP Pro
(2002) if that makes a difference. I also am not using the photo.
Private Sub MergeButton_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
'SetUp Name Field variables
Dim AccountName As String
Dim Address2 As String
Dim Address3 As String
Dim Contact As String
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
If Me!BusIsTenant = True Then
AccountName = Trim(Me!AccountName)
Else
AccountName = Trim(Me!FirstName) & " " & Trim(Me!MiddleName) & " " &
Trim(Me!LastName)
End If
If IsNull(Me!MailAddress2) Or (Trim(Me!MailAddress2) = "") Then
Address2 = Trim(Me!MailCity) & ", " & Trim(Me!MailState) & " " &
Trim(Me!MailZip)
Address3 = Null
Else
Address2 = Trim(Me!MailAddress2)
Address3 = Trim(Me!MailCity) & ", " & Trim(Me!MailState) & " " &
Trim(Me!MailZip)
End If
If IsNull(Me!AltFName) Then
Contact = ""
Else
Contact = Trim(Me!AltFName) & " " & Trim(Me!AltLName)
End If
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("C:\Handi\Lease\Lease.doc")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("Ax1").Select
.Selection.Text = CStr(AccountName)
.ActiveDocument.Bookmarks("Ax2").Select
.Selection.Text = CStr(Trim(Me!MailAddress1))
.ActiveDocument.Bookmarks("Ax3 ").Select
.Selection.Text = CStr(Address2)
.ActiveDocument.Bookmarks("Ax4").Select
.Selection.Text = CStr(Address3)
.ActiveDocument.Bookmarks("ax5").Select
.Selection.Text = (CStr(Me!HomePhone))
.ActiveDocument.Bookmarks("ax6").Select
.Selection.Text = (CStr(Me!BusPhone))
.ActiveDocument.Bookmarks("Ax7").Select
.Selection.Text = (CStr(Me!Lic))
.ActiveDocument.Bookmarks("Ax8").Select
.Selection.Text = CStr(Contact)
.ActiveDocument.Bookmarks("Ax9").Select
.Selection.Text = (CStr(Me!SocSec))
.ActiveDocument.Bookmarks("ax10").Select
.Selection.Text = (CStr(Me!GateCode))
.ActiveDocument.Bookmarks("ax11").Select
.Selection.Text = (CStr([fsubTenantLedger].Form![Payment Date]))
.ActiveDocument.Bookmarks("ax12").Select
.Selection.Text = (CStr([fsubTenantLedger].Form![Unit]))
.ActiveDocument.Bookmarks("ax13").Select
.Selection.Text = (CStr(Me.txtSize))
.ActiveDocument.Bookmarks("ax14").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![RentRate],
"Currency")))
.ActiveDocument.Bookmarks("ax15").Select
.Selection.Text = (CStr("$18.00"))
.ActiveDocument.Bookmarks("ax16").Select
.Selection.Text = (CStr("$25.00"))
.ActiveDocument.Bookmarks("Ax17").Select
.Selection.Text = (CStr(Format(Nz([fsubTenantLedger].Form![Rent],
0), "Currency")))
.ActiveDocument.Bookmarks("Ax18").Select
.Selection.Text =
(CStr(Format(Nz([fsubTenantLedger].Form![AdmistrationFee], 0), "Currency")))
.ActiveDocument.Bookmarks("Ax19").Select
.Selection.Text = (CStr(Format(Nz([fsubTenantLedger].Form![Lock],
0), "Currency")))
.ActiveDocument.Bookmarks("Ax20").Select
.Selection.Text = (CStr("$0.00"))
.ActiveDocument.Bookmarks("Ax21").Select
.Selection.Text = (CStr(Format(Nz([fsubTenantLedger].Form![MiscChg],
0), "Currency")))
.ActiveDocument.Bookmarks("Ax22").Select
.Selection.Text =
(CStr(Format(Nz([fsubTenantLedger].Form![CreditApplied], 0), "Currency")))
.ActiveDocument.Bookmarks("Ax23").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![Payment
Amount], "Currency")))
.ActiveDocument.Bookmarks("ax24").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![PaidThru],
"mm/dd/yyyy")))
.ActiveDocument.Bookmarks("ax25").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![RentRate],
"Currency")))
.ActiveDocument.Bookmarks("ax26").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![Payment
Amount], "Currency")))
.ActiveDocument.Bookmarks("ax27").Select
.Selection.Text = (CStr(Format([fsubTenantLedger].Form![PaidThru],
"mm/dd/yyyy")))
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
Else
MsgBox Err.Number & vbCr & Err.Description
End If
Exit Sub
End Sub
[/QUOTE]