Hi
I have a database which produces a word document with bookmarks to infill the data from Access. The code still works and opens the word document but this is only in read only and it does not infill the data e.g. name and address. This only seems to have happened since upgrading to office 2016.
The code is:
Private Sub CreateLetter_Click()
On Error GoTo Err_CreateLetter_Click
Dim MyWordApp As Object
Set MyWordApp = CreateObject("Word.Application")
MyWordApp.Visible = True
Set worddoc = MyWordApp.Documents.Open("\\location\NTC Letter to tenants unable to contact1.dotx")
Set WordRef = worddoc.bookmarks("txtRefNo").Range
Set WordDateRec = worddoc.bookmarks("txtDateRec").Range
Set WordName = worddoc.bookmarks("txtTenant1").Range
Set WordAdd = worddoc.bookmarks("txtAddress").Range
Set WordName3 = worddoc.bookmarks("txtTenant3").Range
WordRef.InsertAfter Me.TenancyNumber.Value
WordDateRec.InsertAfter Me.TenancyStartDate.Value
WordName.InsertAfter Me.Tenant1.Value & " " & Me.Tenant2.Value
WordAdd.InsertAfter Me.Address.Value
WordName3.InsertAfter Me.Tenant1.Value & " " & Me.Tenant2.Value
Exit_CreateLetter_Click:
Exit Sub
Err_CreateLetter_Click:
MsgBox Err.Description
Resume Exit_CreateLetter_Click
End Sub
Does anyone have any ideas?
thanks
Andrew