Aspose.Word with VB 6

Hi,
We are evaluating your product for a Vb app. and an ASP.Net app.
The structure of recordset(dataset) is:
field1 value1
field2 value2
....
In ASP.Net app. using the fist implementation of MailMerge.Execute method we can update the fields in a word template.

We try to do the same things in a VB app, but we are getting following error: "Run-time error '-2147467261(80004003)': Key cannot be null. Parameter name:key"

This is the code which generates the error

Private Sub Form_Load()
Dim Word As Object
Dim fld(1) As String
Dim val(1) As Variant

fld(0) = "field1"
val(0) = "value1"

Set Word = CreateObject("Aspose.Word.Word")
Dim srcDoc As Object 'template
Dim destDoc As Object 'destination document
Dim mapFields() As String
Set srcDoc = Word.open("C:\test.dot")

destDoc = srcDoc.MailMerge.Execute(fld, val)

destDoc.save "c:\test.doc"

Set Doc = Nothing
Set Word = Nothing
End Sub

Thank you for your help

Hi,

Thank you for considering Aspose.

You simply forgot to set the remaining array items:


fld(1) = "field2"

val(1) = “value2”




Hi,
Stupid mistake. Thanks

But I have other problem. I cannot save the the file.
I try this: destDoc.Save_4 “c:\test.doc”,0
And I got following error message: “Destination can be a .Net stream or a file name.”
What I want is to open the new file in Word app for future editing.
Thank you for your help

Just use destDoc.Save "c:\test.doc" instead.

I try it and I got this error message: “Expected header drawing, but got something else. Please report this file to word@aspose.com”

Please attach the document to let us see.

Please see the attached document

Resave your document template (.dot) as a regular Word document (.doc) and work with it instead of the current .dot. All should work fine then.

I done what you said, and I am gettig the same error message.

This is the code

’open the template
Set srcDoc = Word.open(“C:\test.dot”)
'save it
'this line generates the error
srcDoc.Save “C:\test.doc”)

Set destDoc = Word.Open(“C:\test.doc”)
destDoc.MailMerge.Execute fld, val
destDoc.Save “C:\Test.Doc”)

Thank you for you help

Sorry, I possibly forgot to say that resaving should be done not programmatically, but via MS Word manually. Open the .dot in Word, save it as .doc and work with it.

This is working
Thank you for your help