1) I have created a very very simple .NET class library as follows appended
at the end of this post
2) I have registered the code as follows:
regasm /tlb:testInterop.tlb testinterop.dll
3) I could browse this testInterop.tlb with even the object browser in
Microsoft Word 2003 VBA!
4) If I try to invoke the code from VBScript/ASP as follows:
--------Start of VBScript Code-------
Dim objTest
Set objTest = CreateObject("testInterop.Test")
objTest.DoSomething
--------End of VBScript Code-------
4.1) I get error as follows:
------start of error------
Microsoft VBScript runtime error '800a01ad'
ActiveX component can't create object: 'testInterop.Test'
/testInterop.asp, line 4
------end of error------
I can't think the code could get any simpler any yet it's not working!!
Please help!!!
--------------------------Start of .NET Code--------------------------
using System;
using System.Runtime.InteropServices;
using System.IO;
namespace MyOrg.web.publications
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Test
{
public Test()
{
//
// TODO: Add constructor logic here
//
}
public void DoSomething()
{
StreamWriter fileStream;
fileStream = File.CreateText("c:\\temp\\test.txt");
fileStream.WriteLine("Test");
fileStream.Flush();
fileStream.Close();
}
}
}
--------------------------End of .NET Code--------------------------