Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C# dll referenced by Excel 2000

3 views
Skip to first unread message

developer@discussions.microsoft.com Ms developer

unread,
Mar 26, 2008, 9:30:00 PM3/26/08
to
Hi,

I'd like to make a C# class library project and build a dll file which is
supposed to be referenced by Excel 2000 VBA > Tools > References. In this
way, i suppose that my excel spreadsheet can call my own custom functions.

However, there was an error message when i tried to reference the dll file.
The error was that i couldn't reference the dll file and NOT all the dll file
could be referenced.

So, how can i solve this problem? Thank you very much.

B.Rgds

Ms developer

unread,
Mar 31, 2008, 1:06:00 AM3/31/08
to
Hi,

I raised this question on 26-Mar but now it's 31-Mar. What happens? May i
have my answer within today? Thanks a lot.

B.Rgds.

jia...@prcvap.microsoft.com

unread,
Mar 31, 2008, 6:10:40 AM3/31/08
to
Hello,

According to your description, you are trying to reference an Office's dll, which is referenced VBA, from a .NET project. If I misunderstand your question, please let me know.

The dll reference by VBA is a native dll that cannot be referenced by .NET solution directly. Our .NET solution needs to reference the object library from PIA (Primary Interop Assembly):
http://www.microsoft.com/downloads/details.aspx?FamilyId=3C9A983A-AC14-4125-8BA0-D36D67E0F4AD

After you install the PIA, you can go to Add Reference -> COM -> Microsoft Excel Object library in Visual Studio.

Regards,
Jialiang Ge
Microsoft Online Support

Ms developer

unread,
Mar 31, 2008, 8:14:01 AM3/31/08
to
Hi,

Sorry, you mis-understood my question. I meant the opposite.

I want to reference a dll in Ms Excel 2000 VBA. That dll is compiled by
VS2005.

In this way, in Excel I can call any functions that are exposed by the dll.

However, I failed to do so. Why? Pls kindly advise. Thanks.

B.Rgds

jia...@prcvap.microsoft.com

unread,
Apr 2, 2008, 9:29:49 PM4/2/08
to
Hello,

Sorry for my misunderstanding. We need to enable the "Register for COM interop" checkbox in the .NET project properties. Compile the project. Add a COM reference to the interop type
library (TLB) that has been created for the .NET DLL from Excel
0 new messages