Today we came across interesting problem regarding mail merge letter with regards to Dynamics CRM.
We were generating customer letter from Dynamics CRM Mail merge.
Our letter was four page letter and we had mail merge template setup and letter generated fine.
But while printing we wanted to print first page of company letter pad and other one on normal page. Well if you just print the mail merge generated letters then it consider the entire letter as one document and print them in just one print job.
So we used to get only first page of first letter on company letter page while others are printing normally which is not correct…
Well after much investigation (or should I say trial and error method) we found the solution and following steps to achieve the same..
1. Open Relevant word Document or Letter
2. Alt + F11 to open the Visual Basic Editor.
3. Module -> Insert Module
4. Copy following code and past in there…
Dim i As Long
For i = 1 To ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
5. Close the Visual Basic Editor
6. Go to View -> Macros (or Tool-> Macro -> Macros for Office 2K3 ) and double click PrintSectionsToSubDoc()