Very Basic Mail Merge Required
Posted on 2003-12-07
In a previous question I was given an excellent and very robust example of automating word mail merge. It accounted for many scenarios and was very comprehensive. However, Im a newbie to COM automation and I think I need to start smaller so I can understand the process better and work my way up to bigger things. If anyone can provide me an example or sample of how to perform a Very Simple mail merge given the following information:
The data source for the word document is a query called qryBusLicMailMerge (it is created dynamically prior to the merge)
The data source is in the Current database (I would like to use Currentdb if possible instead of specifying C:Desktop....etc)
The word document is located in Currentdb path/Documents/BusCertificate.doc (Once again Id like to use whatever path the current db is in to make this portable for development purposes.
The word document is already set up with merge fields and data source(not sure if data source needs to be set each time during automation)
I would like it to use the word document specified above but merge it to a new word document and close the original right away so your left with a document that they can save or delete and has no effect on the original.
The user would be responsible for doing File->Print, but I will probably make an alternative later that sends directly to the printer while hiding word.
The procedure will go like this:
Private Sub cmdPreview_Click()
On Error GoTo Err_cmdReceiptPreview_Click:
Call <<Merge Function or Procedure that I dont yet have>>
On Error Resume Next
MsgBox "Error Number~ " & Err.Number & vbCrLf & Err.DESCRIPTION
I am using Office 2000
If anyone can walk through this with me I would be indebted. Let me know if you need more info