Solved

Error calling MSWord function from a Powerbuilder application

Posted on 2003-12-04
4
437 Views
Last Modified: 2007-12-19
A Word document is stored in a Oracle database as blob.
It is retrieved during run time into a Blob variable and then assigned to a OLE control (OLE_1.Objectdata = Blob variable).
Then we declare a local variable of type "oleobject" and is initiated by OLE_1.object ( ole_object_variable = ole_1.object)
Now onwards we use the local "oleobject" variable to execute MSword methods(functions) like
ole_object_variable.mailmerge.opendatasource(...).
MS Excel spread sheet is used as data source.
We are NOT using "create" and "ConnectToObject" functions.
This setup was working fine with older versions of MSWord & MS Excel.
 
Opendatasource function description ...
 Ole_object.MailMerge.OpenDataSource(Name As String, [Format], [ConfirmConversions], [ReadOnly], [LinkToSource], [AddToRecentFiles], [PasswordDocument], [PasswordTemplate], [Revert], [WritePasswordDocument], [WritePasswordTemplate], [Connection], [SQLStatement], [SQLStatement1], [OpenExclusive], [SubType*])
Our current code...

iole_mergeto.MailMerge.OpenDataSource("c:\_junk.xls",la_zero,la_false,true,la_false,la_false,
la_nulstring,la_nulstring,la_false,la_nulstring,la_nulstring,"Entire Spreadsheet",la_nulstring,la_nulstring)

As per MS web site, to make this function work (in word2002) as before we need to pass a new parameter "SubType". They have given the value to be passed for that. But when I do, I get run time error "Illegal parameter passed..." .

Sometime it just says "Error calling External function..."

We are using PB 6.5, Win XP and Office XP.

I highly appreciate your any suggestions which helps me solve this critical, long standing issue.

Thanks,

0
Comment
Question by:Meena_kumari
  • 2
4 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 125 total points
ID: 9880938
you used the long value for the subtype parameter? since i see a nullstring and not the value of the parameter in your connect string

if you record a macro connecting manually and compare the recorded string to the one you use can you make it work from there or not?
0
 

Author Comment

by:Meena_kumari
ID: 9881430
What I have shown was my current code , not the modified code. Currently we are not passing
[OpenExclusive], [SubType*] . [OpenExclusive] was there earlier but optional. And [SubType] is
the new argument for Word 2002. We were not passing value for [OpenExclusive] so far.
 
In the modified code I am passing boolean value for [OpenExclusive] and a string value for [SubType*])
 
Value passed for SubType is "wdMergeSubTypeWord2000"
 
I did not understand your Macro part. Can you please explain it once more.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 9884447
wdMergeSubTypeWord2000

has a value of long in word 2003 and the value passed is 8

so if you try to pass 8 instead of the string value what happens?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
This article will show you how to use shortcut menus in the Access run-time environment.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question