you add a Bookmark to to your Word Template and fill the value from your Form.
Private Sub Combo1141_Click()
'Dim dbHR As DAO.Database
'Dim rstMerg As DAO.Recordset
Dim wd As Object, editor As Object
Dim doc As Object
Dim oMail As MailItem
'ADD INFO TO MERGE TABLE
' DoCmd.OpenQuery "Delete_Temp_Table"
' Set dbsHR = CurrentDb
' Set rstMerg = dbsHR.OpenRecordset("Temp_Table")
'
'
' rstMerg.AddNew
' rstMerg!Candidate_Name = Me.Candidate_Name
' rstMerg!Tentative_Start_Date = Me.Tentative_Start_Date
' rstMerg!Reporting_Manager = Me.Reporting_Manager
' rstMerg.Update
'arnelgp
'add bookmark on your word document to hold:
'
'Candidate_Name
'Tentative_Date
'Reporting_Manager
'
'then you open the Template and save it to temp document
'anywhere in your pc.
'
'copy the template (code)
Dim sDoc As String
sDoc = Environ$("Temp") & "\tmpMM.docx"
'delete temp file if already exists
If Dir$(sDoc) <> "" Then Kill sDoc
'now copy it
VBA.FileCopy "U:\Operations\Database\Mail Merg\First Day Details (Contractor).docx", sDoc
'open the temp docx
Set wd = CreateObject("Word.Application")
Set doc = wd.Documents.Open(sDoc)
'fill the Bookmark of this document
With objwd.Selection
.Goto WHAT:=wdGoToBookmark, Name:="Candidate_Name"
.TypeText Text:=Me!Candidate_Name & ""
.Goto WHAT:=wdGoToBookmark, Name:="Tentative_Date"
.TypeText Text:=Me!Tentative_Start_Date & ""
.Goto WHAT:=wdGoToBookmark, Name:="Reporting_Manager"
.TypeText Text:=Me!Reporting_Manager & ""
End With
'save the document, coy content and close
With doc
.Save
.Content.Copy
.Close
End With
Set wd = Nothing
' 'WORD DOCUMENT OPENING
'
'
' Set wd = CreateObject("Word.Application")
' Set doc = wd.Documents.Open("U:\Operations\Database\Mail Merg\First Day Details (Contractor).docx", ReadOnly)
' doc.Content.Copy
' doc.Close
' Set wd = Nothing
'Email Opening and create
Set OutApp = CreateObject("Outlook.Application")
Set oMail = OutApp.CreateItem(0)
With oMail
.BodyFormat = olFormatRichText
.Display
Set editor = .GetInspector.WordEditor
editor.Content.Paste
End With
End Sub