Nader,
Do not know how your mailmerge code works but to find the active
connection I use a BASIC function written by Roberto Benitez ( is part
of the BaseTools extension.
Hope it helps
Fernand
Function ThisConnection(Optional Event As Object) As Object
REM find an active connection. the first attemp should be to get it
from the active form model (call function MeModel)
REM if that returns null, try to get it from an event (if passed). if
not event passed, try to get one from ThisComponent (if writer doc)
REM the function MeModel will try to use ThisComponent as a last resort,
so if that returns null, then this approach will fail as well
Dim FormModel As Object
If Not IsNull(ActiveConnection) Then
ThisConnection=ActiveConnection
Exit Function
End If
If IsMissing(Event) Then
FormModel=MeModel
Else
FormModel=MeModel(Event)
End If
If IsNull(FormModel) Then 'try to get from ThisCompnent or from
event if event param passed
If IsMissing(Event) Then
ActiveConnection=getConnectionFromThisComponent()
Else
ActiveConnection=getConnectionFromEvent(Event)
End If
Else
ActiveConnection=FormModel.ActiveConnection 'get active
connection from active form model
End If
ThisConnection=ActiveConnection
End Function
Dear,
I hope this message reaches you in good health.
I hope you can assist me with some information.
I am trying to do MailMerge programatically. I was able to do the mail merge properly when connecting an Excel sheet with an open office template file. However, my program aims to connecting a MySQL datasource with the template and calling the mail merge from my java program to do the merge. I created my desired template, and inserted my fields into the template, the mail merge works perfectly. If I call mail merge from my program, the connection for MySQL fails. After a long investigation in the problem, I realized that I am not setting up the proper connection for the mail merge.
Therefore, if you can please assist me in explaining for me how to set up the
"ActiveConnection" as a mail merge parameter. Upon searching the net, I have
come across XConnection but I was not able to create one.
I would really appreciate your help.
Regards,
Nader
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]