Solved

Error calling MSWord function from a Powerbuilder application

Posted on 2003-12-04
4
433 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now