I have an Excel Spreadsheet which writes output to a word document, which internally uses macros to mail merge the document.

During the writing of the output to the Word Document, there is an error saying "Error : 509 - The MailMergeToDoc Command is not available because the document is not a mail merge main document."

I am using the command wordBasic.MailMergeToDoc Command for Mail Merge.

The Same Setup is working in an similar environment in another machine.