Ambat bhath
Ambat bhath

Reputation: 1455

PowerBuilder 10.5 with MS Office 2010

We are using MS Office 2010 with PowerBuilder 10.5. While using mail merge functionality from PowerBuilder application. It got application terminated. But in the later version works as usual..

I checked the Word document in the older version.. When opening that word document ( mail merge used in that) the data file (recipient file of address_data.xls) also will be opening. But in the Newer version it didn't open. is there any option to open the excel file, while opening the document?

When opening the mail merged word document. It opens with Excel file in MS Office 97. But this is not working in MS Office 2010. I need to open that document in MS Office 2010 - Word 2010 so this should open that excel file too. How can I do that?

Upvotes: 1

Views: 4296

Answers (1)

Hugh Brackett
Hugh Brackett

Reputation: 2706

Try opening the Word document like this:

iole_word = CREATE OLEObject
li_result  = iole_word.ConnectToNewObject("word.application")
// error checking code omitted

// args: FileName, [ConfirmConversions], [ReadOnly], [AddToRecentFiles]
ole_1 = iole_word.Documents.Open(is_infile,FALSE,FALSE,FALSE)

I didn't show it here, but you should put the whole thing in a try-catch block and catch oleruntimeerror. If Word can't open the file, it throws oleruntimeerror. I presume that's also what it's throwing when the MailMerge fails.

If that doesn't work I'd make a new mailmerge document for Office 2010. If you need to support both versions you could check the Word version via the OLE interface to determine which document to use.

Upvotes: 0

Related Questions