ASP ActiveX / CreateObject sample code


I downloaded Aspose.Word to try it out. Installed the MSI file on the server with IIS. I saw the sample code for C# and VB, but none for ASP. I’ve tried:
Dim obj
obj = Server.CreateObject(“Aspose.Word”)

as well as Aspose, Aspose.Word.Word, and anything else I could think of, but I always get "ActiveX component can’t create Object ‘Aspose.Word’"

I’m not sure where to go from here, I can’t even get a reference to it from VB, but it was installed (have it in the registry). Any ideas? Can someone post a very simple code snippet for ASP? Like, create the object, open a file, close the file? Just to get the syntax down?

Thank you,

Michael Scovetta


Hi Michael,

The sample code for ASP is available in the documentation for the MailMerge.ExecuteADO and MailMerge.ExecuteWithRegionsADO methods.

The ProgID is “Aspose.Word.Word” because the component is called Aspose.Word and the root class is called Word.

Dim RS
Set RS = CreateObject(“ADODB.Recordset”)
RS.Open _
“SELECT TOP 50 * FROM Customers ORDER BY Country, CompanyName”, _
“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Northwind.mdb”

Dim Word
Set Word = CreateObject(“Aspose.Word.Word”)

Dim Doc
Set Doc = Word.Open(“CustomerLabels.doc”)

Doc.MailMerge.ExecuteADO RS
Doc.Save “X:\Aspose\Other\CustomerLabels Out VBScript.doc”