Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem when merging word and excel Office 365 Proplus from powerbuilder 12.5 application

Status
Not open for further replies.

dc03kks

Programmer
Nov 12, 2015
3
GR
Hi guys,

i have a problem when trying to merge a word to excel (Office 365) through powerbuilder 12.5 application.

The below code is working fine in earlier versions of Office... But not in Office 365 Proplus..

Have a look, and if someone have a suggestion please dont hesitate,, any reply would be really appreciated!!

The code for the Microsoft Office transactions...

if ll_systemPrintouts = iuo_tools.MS_OFFICE then

oleobject iole_word
long ll_Error
iole_word = CREATE oleobject
ll_Error = iole_word.ConnectToNewobject("word.application")

CHOOSE CASE ll_Error
CASE -1, -2, -3, -4, -9, -15, -16
word_exception luo_exception
luo_exception.setmessage ( "The application cannot connects with Word" )
luo_exception.setexplain ( "Code Error: " + String ( ll_Error ) )
Throw luo_exception
END CHOOSE

iole_word.Documents.Open( ls_path )

iole_word.ActiveDocument.MailMerge.MainDocumentType = 0
iole_word.ActiveDocument.MailMerge.OpenDataSource( ls_DataSourceFile,0,false,false,false,false,"","",false, &
"", "", "Entire Spreadsheet", "SELECT * FROM 'Sheet1$'", "", false, 8)
iole_word.ActiveDocument.MailMerge.Destination = 0
iole_word.Application.Visible = abl_visible

return iole_word

else
.....
Bear in mind that the applications crashes on , ActiveDocument.MailMerge.OpenDataSource

Please guys i m so stack in this point and dont know what to do :( any help would be really appreciated

Thank you in advance
 
Thank you Matt for the reply ,

the only documentation for this method that i can find on the net is for office 2003 and is the following passing 16 parameters like my code.. with the following description,

.........................
This documentation is archived and is not being maintained.
OpenDataSource Method

Office 2003
Attaches a data source to the specified document, which becomes a main document if it's not one already.
expression.OpenDataSource(Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1, OpenExclusive, SubType)
expression Required. An expression that returns a MailMerge object.
Name Required String. The data source file name. You can specify a Microsoft Query (.qry) file instead of specifying a data source, a connection string, and a query string.

.............................

cant find for office 365... :(
 
As it is not in the code sample you provided but is the value in ls_DataSourceFile valid (correct path and filename)?

Matt

"Nature forges everything on the anvil of time"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top