Hi,
I have problem with passing parameters to method
OpenDataSource. I need set connection string and
SqlStatement.
OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1)
The VBA equivalent:
WordBasic.MailMergeOpenDataSource Name:="", LinkToSource:=1, _
Connection:=conect$, SQLStatement:=select1$, _
SQLStatement1:=select2$
I tried it with data in file and it works fine, but it`s only with first parameter "Name" - name of data file.
I tried to write something like
lst := ole2.create_arglist;
ole2.add_arg (lst, 'E:\ODT\CLIENT\odt_export_dat1.txt'); -- Name of data file
ole2.add_arg (lst, '' ); --Format
-- ole2.add_arg (lst, '' ); --ConfirmConversions
-- ole2.add_arg (lst, ''); --ReadOnly
-- ole2.add_arg (lst, ''); --LinkToSource
-- ole2.add_arg (lst, ''); --AddToRecentFiles
-- ole2.add_arg (lst, ''); --PasswordDocument
-- ole2.add_arg (lst, ''); --PasswordTemplate
-- ole2.add_arg (lst, ''); --Revert
-- ole2.add_arg (lst, ''); --WritePasswordDocument
-- ole2.add_arg (lst, ''); --WritePasswordTemplate
-- ole2.add_arg (lst, sConnectString); --Connection
-- ole2.add_arg (lst, sSelect); --SQLStatement
-- ole2.add_arg (lst, '1'); --SQLStatement1
ole2.invoke(obj_merge, 'OpenDataSource',lst);
ole2.destroy_arglist(lst);
but it doesn`t work. It works with two parameters but if i add third it clears all settings.
What is wrong ? How to set specific parameters.
Where I find description of HRESULTs codes ?
In this case error code is 2148144860.
Any thoughts welcome.
Thanx.
I have problem with passing parameters to method
OpenDataSource. I need set connection string and
SqlStatement.
OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1)
The VBA equivalent:
WordBasic.MailMergeOpenDataSource Name:="", LinkToSource:=1, _
Connection:=conect$, SQLStatement:=select1$, _
SQLStatement1:=select2$
I tried it with data in file and it works fine, but it`s only with first parameter "Name" - name of data file.
I tried to write something like
lst := ole2.create_arglist;
ole2.add_arg (lst, 'E:\ODT\CLIENT\odt_export_dat1.txt'); -- Name of data file
ole2.add_arg (lst, '' ); --Format
-- ole2.add_arg (lst, '' ); --ConfirmConversions
-- ole2.add_arg (lst, ''); --ReadOnly
-- ole2.add_arg (lst, ''); --LinkToSource
-- ole2.add_arg (lst, ''); --AddToRecentFiles
-- ole2.add_arg (lst, ''); --PasswordDocument
-- ole2.add_arg (lst, ''); --PasswordTemplate
-- ole2.add_arg (lst, ''); --Revert
-- ole2.add_arg (lst, ''); --WritePasswordDocument
-- ole2.add_arg (lst, ''); --WritePasswordTemplate
-- ole2.add_arg (lst, sConnectString); --Connection
-- ole2.add_arg (lst, sSelect); --SQLStatement
-- ole2.add_arg (lst, '1'); --SQLStatement1
ole2.invoke(obj_merge, 'OpenDataSource',lst);
ole2.destroy_arglist(lst);
but it doesn`t work. It works with two parameters but if i add third it clears all settings.
What is wrong ? How to set specific parameters.
Where I find description of HRESULTs codes ?
In this case error code is 2148144860.
Any thoughts welcome.
Thanx.