Unanswered: Document Merge - Access 2003 to Word 2010
I was looking for some help if possible. I have a database which we use to fill in a word based document.
My company is looking to upgrade MS Office to the 2010 version (this has already been done on my PC) and I have now discovered that the code that I previously used for mail merge no longer works with Word 2010.
Does anyone know what needs to be changed in order to make this code work with 2010?
Is there code that will work with both versions, no matter which Word is installed on the machine, or will it be best to distribute 2 versions of the "front end"?
The code that I am currently using is:
Private Sub Form_Open(Cancel As Integer)
Dim appWord As Word.Application
Dim doc As Word.Document
'Avoid error 429, when Word isn’t open.
On Error Resume Next
'Set appWord object variable to running instance of Word.
Set appWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
'If Word isn’t open, create a new instance of Word.
Set appWord = New Word.Application
Set doc = appWord.Documents.Open("T:\path\form2.doc", , True)
.FormFields("sender").Result = Me!PSCC_Op_Name
.FormFields("DateTime").Result = Me!Date_Raised
.FormFields("cwsite").Result = Me!CW_Site_Code
.FormFields("sitename").Result = Me!Site_Name
.FormFields("remedy").Result = Me!Fault_Number
.FormFields("Action").Result = Me!CCNumber
.FormFields("mitiesite").Result = Me!Mitie_Site_Code
.FormFields("authdm").Result = Me!Auth_DM_Name
.FormFields("group4").Result = Me!G4_Site_Code
.FormFields("Address").Result = Me!Address
.FormFields("postcode").Result = Me!Post_Code
.FormFields("details").Result = Me!Request_Description
.FormFields("Type").Result = Me!Fault_Type
.FormFields("Priority").Result = Me!Priority
.FormFields("controlroomto").Result = Me!Dist_List
.Visible = True
Set doc = Nothing
Set appWord = Nothing
Any help you could provide would be much appreciated