Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling dotnet assembly from word 97
Message
 
À
19/12/2007 10:07:26
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01276599
Message ID:
01276608
Vues:
19
I just tried a very basic Hello World type lib, and received an error -2146232576 (80131700) COM error when trying to CreateObject("MyClass") in a Excel macro, the assembly appeared in the reference list in th vba editor but on creation of object BOOM, that's why I asked the group, thanks anyway

This is the Excel macro
Sub Button1_Click()
Dim obj As CallingCSharpFromWord97.PJKWordClass

Set obj = CreateObject("CallingCSharpFromWord97.PJKWordClass")
obj.WriteLogFile "MS Word"

Set obj = Nothing

End Sub
And the C# class
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();
        }

   }
}
The class is callable from VFP7 with no problem I think maybe it's a Office 97 issue.
Regards,
Peter J. Kane



Pete
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform