P
Pete Kane
Hi All, is it possible to utilise a .NET class library in Word 97 ? I've
tried without success, my test class and VBA macro are shown below
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace CallingCSharpFromWord97
{
public class PJKWordClass
{
public TextWriter tw = null;
public PJKWordClass()
{
}
public void WriteLogFile(string msg)
{
tw = new StreamWriter("c:\\PJKCalledFromWord97.log", true);
tw.WriteLine(String.Format("This file was created by C#
which was called from a COM client {0} at
{1}",msg,DateTime.Now.ToLongDateString()));
tw.Close();
}
}
}
Sub Button1_Click()
I have set a reference to the assembly in the VBA editor but I receive a
COM error -2146232576 (80131700)Automation error when I run it - which
means nothing to me
tried without success, my test class and VBA macro are shown below
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Runtime.InteropServices;
namespace CallingCSharpFromWord97
{
public class PJKWordClass
{
public TextWriter tw = null;
public PJKWordClass()
{
}
public void WriteLogFile(string msg)
{
tw = new StreamWriter("c:\\PJKCalledFromWord97.log", true);
tw.WriteLine(String.Format("This file was created by C#
which was called from a COM client {0} at
{1}",msg,DateTime.Now.ToLongDateString()));
tw.Close();
}
}
}
Sub Button1_Click()
Dim obj As CallingCSharpFromWord97.PJKWordClass
Set obj = CreateObject("CallingCSharpFromWord97.PJKWordClass")
obj.WriteLogFile "MS Word"
Set obj = Nothing
End Sub
I have set a reference to the assembly in the VBA editor but I receive a
COM error -2146232576 (80131700)Automation error when I run it - which
means nothing to me