We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to use the Aspose.Word in Visual basic

Hai,

I want sample code for word document with mail merge operatons using Aspose.Word in Visual basic 6.0. i am tried using com introp, but i got error is Object required.

Code is below

Dim helper
Set helper = CreateObject(“Aspose.Words.ComHelper”)

Thanks

Kesavan.G

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Here is simple code example:

'Create DocumentHelper

Dim helper

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

'Open template document

Dim Doc

Set Doc = helper.Open("C:\Temp\in.doc")

'Here you should get data from your datasource

'As an example the RecordSet was created on fly

'Create new RecordSet

Dim rsParam

Set rsParam = CreateObject("ADODB.Recordset")

rsParam.Fields.Append "FirstName", CInt(129), CInt(40), False

rsParam.Fields.Append "LastName", CInt(129), CInt(40), False

rsParam.Fields.Append "City", CInt(129), CInt(40), False

rsParam.Open

'Fill RecordSet

rsParam.AddNew Array("FirstName", "LastName", "City"), Array("James", "Bond", "London")

'You also can use ExecuteWithRegionsADO method

'Execute MeilMerge

Doc.MailMerge.ExecuteADO rsParam

'Save document

doc.Save("C:\Temp\out.doc")

rsParam.Close()

Please make sure that you registered Aspose.Words.dll properly, as described here:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/use-aspose-words-for-net-via-com-interop.html

Best regards.

This is worked in Windows XP machine. but it doesn’t work in Windows Server 2003 machine

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I just tested on Windows Server 2003 SP2 and all works fine.

Best regards,