Solved

Error calling MSWord function from a Powerbuilder application

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
OneDrive for Office 365 Users 2 64
Word 2016 - Comments on one page contracted 2 54
PC freezes and shutdowns becoming more frequent 17 122
Office 2016 User Guides 5 37
This article will show you how to use shortcut menus in the Access run-time environment.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 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