Running Navision Attain version 3.X and MS Office 2003. Attempting to execute a mail merge between an Excel spreadsheet and a Word document from a modified copy of Codeunit 5054 - WordManagement.
Works beautifully except I’m getting a prompt to Select Table. I need to pass an additional Parameter to wrdDoc.MailMerge.OpenDataSource2000.
According to Microsoft, the syntax for the OpenDataSource method is as follows:
.OpenDataSource(Name, [Format], [ConfirmConversions], [ReadOnly], [LinkToSource], [AddToRecentFiles], [PasswordDocument], [PasswordTemplate], [Revert],[WritePasswordDocument], [WritePasswordTemplate], [Connection], [SQLStatement], [SQLStatement1], [OpenExclusive], [SubType])
The following links provide additional details:
http://support.microsoft.com/kb/289830/
http://support.microsoft.com/kb/285332/EN-US/
I am convinced that I should be able to fix prompt to select table by passing the right parameter – being either:
a) The full name of Excel workbook including the name of the worksheet, for example: ‘P:[Master TEST.xls]Sheet1’
OR
b) An SQL Statement, being [SQLStatement] := SELECT * FROM [Sheet1]
OR
c) A Sub Type, being [SubType] := 8 where 8 is the wrdMergeSubType wrdMergeSubTypeWord2000.
But this is as far as I can get.
Any assistance would be greatly appreciated.