首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

【HELP】vba createobject不成功解决思路

2012-09-22 
【HELP】vba createobject不成功一下我用C#写的测试代码:C# codeusing Systemusing System.Reflectionusin

【HELP】vba createobject不成功
一下我用C#写的测试代码:

C# code
using System;using System.Reflection;using System.Windows.Forms;[assembly:   AssemblyKeyFile( "C:\\Documents and Settings\\Administrator\\My Documents\\Downloads\\SimpleCLRHost_demo\\HelloMsgBox.snk")]namespace Ranjeet.SimpleCLRHost{    public class HelloHostDemo    {        public void Hi()         {        MessageBox.Show("YOO HOO from the Managed World!", "And now for this message");        }    }}


然后编译为DLL,接着使用regasm.exe 注册该DLL成功

一切成功后,最后开始在VBA中测试,打开EXCEL:

VB code
Public lngStatus As ObjectSub test()    On Error GoTo an_error    If lngStatus Is Nothing Then        lngStatus = CreateObject("Ranjeet.SimpleCLRHost.HelloHostDemo")    End If    an_error:End Sub


可恨的是CreateObject不成功,"Ranjeet.SimpleCLRHost.HelloHostDemo"的名称是无误的,请问哪位大虾帮帮忙,是不是我中间缺少了某个过程

[解决办法]
参考下面的内容:
http://blog.csdn.net/neohope/article/details/6086893

热点排行