Private Sub cmdNewReport_Click()
Const conTEMPLATE_NAME = "X:\Templates\Asbestos Survey.dot"
Set mobjWordApp = New Word.Application
With mobjWordApp
.Visible = True
.WindowState = wdWindowStateMaximize
.Documents.Add Template:=(conTEMPLATE_NAME)
.ActiveDocument.Bookmarks("bmkProjName1").Range.Text = Me.strProjectName
.ActiveDocument.Bookmarks("bmkProjName2").Range.Text = Me.strProjectName
.ActiveDocument.Bookmarks("bmkProjCity1").Range.Text = Me.City
.ActiveDocument.Bookmarks("bmkProjCity2").Range.Text = Me.City
.ActiveDocument.Bookmarks("bmkProjPC1").Range.Text = Me.PostCode
.ActiveDocument.Bookmarks("bmkProjPC2").Range.Text = Me.PostCode
.ActiveDocument.Bookmarks("bmkClientName").Range.Text = Me.Client
.ActiveDocument.Bookmarks("bmkClientAdd").Range.Text = Me!sub_Clients.Form.ClientAdd
.ActiveDocument.Bookmarks("bmkSurveyDate").Range.Text = Me.Asb_SurveyDate
.ActiveDocument.Bookmarks("bmkSurveyDate2").Range.Text = Me.Asb_SurveyDate
.ActiveDocument.Bookmarks("bmkProjRef").Range.Text = Me.cbxProject
.ActiveDocument.Bookmarks("bmkSurveyRef").Range.Text = Me.Asb_SurveyRef
If IsNull(Me.Address) Then
Else
.ActiveDocument.Bookmarks("bmkProjAdd1").Range.Text = Me.Address
.ActiveDocument.Bookmarks("bmkProjAdd1b").Range.Text = Me.Address
End If
If IsNull(Me.Address2) Then
Else
.ActiveDocument.Bookmarks("bmkProjAdd2").Range.Text = Me.Address2
.ActiveDocument.Bookmarks("bmkProjAdd2b").Range.Text = Me.Address2
End If
End With
DoEvents
Set mobjWordApp = Nothing
On Error GoTo Err_Enveloppe2_Click
Exit_Enveloppe2_Click:
Exit Sub
Err_Enveloppe2_Click:
MsgBox Err.Description
Resume Exit_Enveloppe2_Click
End Sub