B
Bouwman
Hi guys,
(vb6)
I want to present to the user a blank word document with a known
datasource àttached` to that document.
We tried the code as shown below. The effect of that code is that it
tries to perform the mailmerge. That is not what we want. We can't find
an `addDatasource` statement or something to that effect.
Thanks in advance,
Peter
********** CODE ***************
Dim MyMailMerge As Object 'MailMerge
Dim oDoc As Object
Dim WVersion As String
WVersion = cpWordApp.Version
cpWordApp.Visible = cpWordVisibleJN
Set oDoc = cpWordApp.Documents.Add
Set MyMailMerge = oDoc.MailMerge
If WVersion = "9.0" Then
'Office 2000
MyMailMerge.OpenDataSource Name:="", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:=cpConnStr, SQLStatement:="select * from selektie"
End If
If WVersion = "10.0" Then
'Office XP
MyMailMerge.OpenDataSource Name:="", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:=cpConnStr, SQLStatement:="select * from selektie", _
SubType:=wdMergeSubTypeWord2000
End If
Set MyMailMerge = Nothing
Set oDoc = Nothing
(vb6)
I want to present to the user a blank word document with a known
datasource àttached` to that document.
We tried the code as shown below. The effect of that code is that it
tries to perform the mailmerge. That is not what we want. We can't find
an `addDatasource` statement or something to that effect.
Thanks in advance,
Peter
********** CODE ***************
Dim MyMailMerge As Object 'MailMerge
Dim oDoc As Object
Dim WVersion As String
WVersion = cpWordApp.Version
cpWordApp.Visible = cpWordVisibleJN
Set oDoc = cpWordApp.Documents.Add
Set MyMailMerge = oDoc.MailMerge
If WVersion = "9.0" Then
'Office 2000
MyMailMerge.OpenDataSource Name:="", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:=cpConnStr, SQLStatement:="select * from selektie"
End If
If WVersion = "10.0" Then
'Office XP
MyMailMerge.OpenDataSource Name:="", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:=cpConnStr, SQLStatement:="select * from selektie", _
SubType:=wdMergeSubTypeWord2000
End If
Set MyMailMerge = Nothing
Set oDoc = Nothing