Problem calling VB.NET DLL from Excel VBA

P

Phil

I have built a DLL (VB.NET 2005) with a COM interface so that it can be
called from VBA in Excel. I have installed it successfully on several
machines with no problem, but on two machines it doesn't work. I get the
following error from VBA when trying to create the object:

Runtime Error -2147024894 (80070002)
File or assembly name MYDLL, or one of its dependencies, was not found.

The two machines which don't work both have Office XP. The others all have
Office 2003.
Any ideas or suggestions how I start tracking down this problem?
My DLL doesn't (AFAIK) have any dependencies except on .NET System.

TIA
Phil.
 
R

rowe_newsgroups

Phil said:
I have built a DLL (VB.NET 2005) with a COM interface so that it can be
called from VBA in Excel. I have installed it successfully on several
machines with no problem, but on two machines it doesn't work. I get the
following error from VBA when trying to create the object:

Runtime Error -2147024894 (80070002)
File or assembly name MYDLL, or one of its dependencies, was not found.

The two machines which don't work both have Office XP. The others all have
Office 2003.
Any ideas or suggestions how I start tracking down this problem?
My DLL doesn't (AFAIK) have any dependencies except on .NET System.

TIA
Phil.

You do have the .NET framework installed right?

Thanks,

Seth Rowe [MVP]
 
P

Phil

You do have the .NET framework installed right?
Yes :)
First thing I checked.
There is even another VB application of mine installed on the machine which
is working fine. That application is not COM-enabled though. It is just the
calling of my DLL from VBA that I'm having a problem with.
 
K

kimiraikkonen

I have built a DLL (VB.NET 2005) with a COM interface so that it can be
called from VBA in Excel. I have installed it successfully on several
machines with no problem, but on two machines it doesn't work. I get the
following error from VBA when trying to create the object:

Runtime Error -2147024894 (80070002)
File or assembly name MYDLL, or one of its dependencies, was not found.

The two machines which don't work both have Office XP. The others all have
Office 2003.
Any ideas or suggestions how I start tracking down this problem?
My DLL doesn't (AFAIK) have any dependencies except on .NET System.

TIA
Phil.

Try to turn on indexing service.
Look at this thread:
http://www.velocityreviews.com/foru...or-one-of-its-dependencies-was-not-found.html
 
S

Steven Cheng[MSFT]

Hi Phil,

From your description, you've built an .NET dll that will be used in office
VBA, however, you found that on some machien with office XP installed, it
report "assembly not found" error ,correct?

Based on my research, there are some similar issue that is caused by the
office application can not correctly locate the .net assembly(of the proper
version). I suggest you try the following things to further troubleshoot:

** First, use a standard .net application to call your installed assembly
component on that machine(with office XP) to ensure the assembly
installation is ok

** For office application, you can consider manually supply a exe.config
file and set the runtime version of .net framework in it. Here is a thread
which mentioned this:

#Re: file or assembly name XXXX not found error for .NET COM interop in VBA
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework
.interop/2005-12/msg00024.html

You can try it to see whether it helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.





--------------------
 
P

Phil

From your description, you've built an .NET dll that will be used in
office
VBA, however, you found that on some machien with office XP installed, it
report "assembly not found" error ,correct?

Yup. That's it.
Based on my research, there are some similar issue that is caused by the
office application can not correctly locate the .net assembly(of the
proper
version). I suggest you try the following things to further troubleshoot:

** First, use a standard .net application to call your installed assembly
component on that machine(with office XP) to ensure the assembly
installation is ok

OK. good idea, I'll try that.
** For office application, you can consider manually supply a exe.config
file and set the runtime version of .net framework in it. Here is a thread
which mentioned this:

#Re: file or assembly name XXXX not found error for .NET COM interop in
VBA
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework
interop/2005-12/msg00024.html

Thanks I'll have a read of that article and let you know how I get on.
Thanks,
Phil.
 
S

Steven Cheng[MSFT]

Thanks for your reply Phil,

welcome to post here if you get any progress.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
S

Steven Cheng

Hi Phil,

Just want to check the status of this issue. Have you got progress or does
the suggestion in previous reply help you some?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
From: (e-mail address removed) (Steven Cheng[MSFT])
Organization: Microsoft
Date: Fri, 15 Feb 2008 02:33:09 GMT
Subject: Re: Problem calling VB.NET DLL from Excel VBA
 
P

Phil

"Steven Cheng" said:
Hi Phil,

Just want to check the status of this issue. Have you got progress or does
the suggestion in previous reply help you some?
Sorry, I've been distracted with other issues, and haven't had chance to try
out your suggestions yet.
 
V

Vince Mikla

I have run into this before... Reference address:
http://richnewman.wordpress.com/2007/04/15/a-beginner’s-guide-to
-calling-a-net-library-from-excel/

If address above is bad... Try this (it works for me):

The workaround for this is to tell Excel explicitly that the version of
the .NET Framework that you are using is supported. To do this create a
text file called Excel.exe.config and put it in the same directory as
Excel.exe itself. The file should contain the text below (with the
version number replaced with the .NET Framework version you are using):

<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
 
P

Phil

Thanks to everyone who responded to this.
The excel.exe.config file did the trick.

Cheers,
Phil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top