J
jpatterson
I am exporting a file from Lotus Notes database saving it as a word
doc, using a table format i.e. firstName, LastName, address, title etc
then doing a mail merge in Word (I actualy have an agent that does all
this). My problem is trying to sort the merge document. I want my
users to be able to sort the document in asending order. The only
option word give me is to sort by column after the merge. I'm using a
standard mailing lable template. I need to be able to sort the entire
document by lastname. Either before the merge or once the document is
merged. below is a little of my code maybe someone know how to sort
prior to merging the document to word. Thanks in advance for the
help.
Call WordDoc.saveas("C:\worddoc\staff.doc")
WordDoc.Close
Call WordObj.Application.quit
Set MergeDoc = MergeView.GetDocumentByKey(templateName,True)
Set rtitem = MergeDoc.GetFirstItem("Body")
Set object = rtitem.GetEmbeddedObject("Microsoft Word Document")
Set WordDoc2 = object.Activate(True)
WordDoc2.MailMerge.MainDocumentType = FormLetters
Call WordDoc2.MailMerge.OpenDataSource("C:\worddoc\staff.doc")
WordDoc2.MailMerge.SuppressBlankLines = True
Call WordDoc2.MailMerge.Execute(True)
doc, using a table format i.e. firstName, LastName, address, title etc
then doing a mail merge in Word (I actualy have an agent that does all
this). My problem is trying to sort the merge document. I want my
users to be able to sort the document in asending order. The only
option word give me is to sort by column after the merge. I'm using a
standard mailing lable template. I need to be able to sort the entire
document by lastname. Either before the merge or once the document is
merged. below is a little of my code maybe someone know how to sort
prior to merging the document to word. Thanks in advance for the
help.
Call WordDoc.saveas("C:\worddoc\staff.doc")
WordDoc.Close
Call WordObj.Application.quit
Set MergeDoc = MergeView.GetDocumentByKey(templateName,True)
Set rtitem = MergeDoc.GetFirstItem("Body")
Set object = rtitem.GetEmbeddedObject("Microsoft Word Document")
Set WordDoc2 = object.Activate(True)
WordDoc2.MailMerge.MainDocumentType = FormLetters
Call WordDoc2.MailMerge.OpenDataSource("C:\worddoc\staff.doc")
WordDoc2.MailMerge.SuppressBlankLines = True
Call WordDoc2.MailMerge.Execute(True)