Free Support Forum -

Using COM and MailMerge

I am having trouble using older VB6 style code with MailMerge and Words. I've seen a lot of posts in this forum but none seem to be up-to-date that I have seen so far. Like the older MailMerge.ExecuteADO which would accept an ADODB.Recordset.

Is that gone? How do I use a Recordset now?

Also - does anyone have any pre-built TLB files for these objects. It's a pain not to get the intellitype in the VB editor to see all the methods and enums etc...

Here is some basic code:

Set helper = CreateObject("Aspose.Words.ComHelper")
Set obj = CreateObject("Aspose.Words.Document")

Set doc = helper.Open("C:\Program Files\Aspose\Aspose.Words\Demos\Documents\MailingLabelsDemo.doc")

rsRec.Open "SELECT TOP 50 Name as [CompanyName],BAddress1 as [Address], BCity as [City], BPostalCode as [PostalCode], BCountry as [Country] FROM CRDACCOUNT Order By Name", dbcnn, adOpenForwardOnly, adLockReadOnly

Call doc.MailMerge.ExecuteADO(rsRec)

doc.Save "C:\Program Files\Aspose\Aspose.Words\Demos\Documents\MailingLabelsDemo_out.doc"

Get no errors on that, but also no mailmerge either!

I think I may have found one problem. Instead of doing an OpenForwardOnly cursor, I changed it to OpenStatic. That seems to have fixed it.

Now - where do I find TLB's for these objects and how come the docs don't show the ExecuteADO ??

Am I looking in the wrong place?

Hi Todd,

Thanks for your interest in Aspose.Words, but we developed it to be mainly used in .NET applications. We are trying not to spend a lot of effort making it COM-enabled. We support the minimum required to get Aspose.Words working in a COM application, but that's about as far as we are prepared to go.

You must have already seen this guide how to use Aspose.Word from a COM application

We don't provide a type library with the component, but the above doc explains how you can generate one. (tlbexp Aspose.Words.dll)

MailMerge.ExecuteADO is in the API reference, not sure how you could have missed it

Thanks for the note about cursor type. We did not experiment with ADO recordsets to this level of detail.

I understand you not going for full-blown support, but some level is good to have and it would be nice to know that it is stated that you will try to keep some level supported. As I look at other products and compare for purchase it is nice to know the developers of the product will not drop support on something you rely on like this stuff.

Since I don't have the tlbexp tool you mention, it would be nice if you included them on your site or in the setup also.

Attached here is a TLB for Aspose.Words 3.7

I guess we do not put TLB into the installer for a number of reasons:

1. Only a small number of clients use Aspose.Words in COM applications.

2. Aspose.Words.tlb is only useful to lookup enumerated values. It is not useful for looking up methods because methods are only available for late-binding (scirpting clients).

Interesting. Too bad the methods are not exposed.

In any case, this is of great help anyway. Since I can easily pull up the Object Browser now and get the enums at least.

Many thanks - Todd!