Home > Archive > PowerBuilder > October 2004 > PB and word mailmerge.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PB and word mailmerge.
|
|
| Steve Cooper 2004-10-26, 3:58 pm |
| Could anyone tell me how to do use the mailmerge OpenDataSource function
from within powerbuilder.
In VB this works :
Word.Application.ActiveDocument.MailMerge.OpenDataSource(Name:="",
Connection:="DSN=testdsn;UID=testuid;PWD=testpwd", SQLStatement:="SELECT *
FROM PERSON", SQLStatement1:="")
If I try the same thing in Powerbuilder I get Error calling external object
function opendatasource .... :
obj_mail_merge.OpenDataSource("", "", "", "", "", "", "", "", "","","",
"DSN=testdsn;UID=testuid;PWD=testpwd", "SELECT * FROM PERSON", "")
obj_mail_merge contains the same path as the VB example.
It's probably to do with the empty parameters i'm using being incorrect, but
I've tried all the variations I can think off.
I can use obj_mailmerge.DataSource.Querystring to set the SQL, but I cannot
find away of setting the DSN this way.
Any help most appreciated.
Steve.
| |
| Manfred Maier 2004-10-26, 3:58 pm |
| Hallo Steve,
have a look to the OLE-Programing
Example (Powerbuilder 6.5):
OLEObject ole_dokument
ole_dokument = CREATE OLEObject
ll_ret = ole_dokument.ConnectToNewObject("Word.Application")
IF ll_ret <> 0 THEN
DESTROY ole_dokument
MessageBox("Ablage", "Kann MS-Word-Verbindung nicht herstellen." + &
"(ret=" + string(ll_ret) + ")", StopSign!)
RETURN
ELSE
******* maybe here *****
ole_dokument.MailMerge.OpenDataSource(Name:="",
Connection:="DSN=testdsn;UID=testuid;PWD=testpwd",
SQLStatement:="SELECT *
FROM PERSON", SQLStatement1:="")
****************************
ole_dokument.Application.Quit
ole_dokument.DisconnectObject()
DESTROY ole_dokument
END IF
--
Manfred Maier
N 48° 22' 36,48" --- E 10° 49' 43,17" --- (WGS84)
"Steve Cooper" <steve@stokesay.com> schrieb im Newsbeitrag
news:43ufd.158906$BI5.100343@fe2.news.blueyonder.co.uk...
> Could anyone tell me how to do use the mailmerge OpenDataSource function
> from within powerbuilder.
>
> In VB this works :
>
> Word.Application.ActiveDocument.MailMerge.OpenDataSource(Name:="",
> Connection:="DSN=testdsn;UID=testuid;PWD=testpwd", SQLStatement:="SELECT *
> FROM PERSON", SQLStatement1:="")
>
> If I try the same thing in Powerbuilder I get Error calling external
object
> function opendatasource .... :
>
> obj_mail_merge.OpenDataSource("", "", "", "", "", "", "", "", "","","",
> "DSN=testdsn;UID=testuid;PWD=testpwd", "SELECT * FROM PERSON", "")
>
> obj_mail_merge contains the same path as the VB example.
>
> It's probably to do with the empty parameters i'm using being incorrect,
but
> I've tried all the variations I can think off.
>
> I can use obj_mailmerge.DataSource.Querystring to set the SQL, but I
cannot
> find away of setting the DSN this way.
>
> Any help most appreciated.
>
> Steve.
>
>
>
|
|
|
|
|