On a database run on a server system the following code was given to me to make a mailmerge word document open and print...
This works fine, but I've been asked to create an exact fully functioning duplicate of the system to run on a machine not connected to the server for training purposes (why?!?!)
so..... the database and mailmerge document now reside in the same folder on this seperate machine, and I changed the code to the following...
But, it doesn't work, nor does anything else I've tried!!!. I get errors re class and file path. Problem is I need to be able to run this in several places so cant tie down to specific paths. Any ideas?!
Code:
If Me![TerrorCover] = True Then
DoCmd.SetWarnings False
Dim objword As Word.Document
DoCmd.OpenQuery "MaketblTerror", acNormal
Set objword = GetObject("\\SERVER\Dbs\MailmergeDoc\TerCert.doc", "Word.Document.8")
objword.Application.Visible = True
objword.MailMerge.Destination = wdSendToNewDocument
objword.MailMerge.Execute
objword.Application.Options.PrintBackground = False
objword.Application.ActiveDocument.PrintOut
objword.Application.quit SaveChanges:=wdDoNotSaveChanges
Set objword = Nothing
DoCmd.SetWarnings True
End If
This works fine, but I've been asked to create an exact fully functioning duplicate of the system to run on a machine not connected to the server for training purposes (why?!?!)
so..... the database and mailmerge document now reside in the same folder on this seperate machine, and I changed the code to the following...
Code:
If Me![TerrorCover] = True Then
DoCmd.SetWarnings False
Dim objword As Word.Document
DoCmd.OpenQuery "MaketblTerror", acNormal
Set objword = GetObject("TerCert.doc", "Word.Document.8")
objword.Application.Visible = True
objword.MailMerge.Destination = wdSendToNewDocument
objword.MailMerge.Execute
objword.Application.Options.PrintBackground = False
objword.Application.ActiveDocument.PrintOut
objword.Application.quit SaveChanges:=wdDoNotSaveChanges
Set objword = Nothing
DoCmd.SetWarnings True
End If
But, it doesn't work, nor does anything else I've tried!!!. I get errors re class and file path. Problem is I need to be able to run this in several places so cant tie down to specific paths. Any ideas?!