473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C# VBA DLL issues

[I've also asked this question in
microsoft.public.dotnet.languages.csharp, and
microsoft.public.excel.programming. If there is somewhere else that
may be able to help, please point me in the right direction!]

I've created a DLL in C# (VS2005, using .NET framework 2.0) for use
with Excel XP (to provide some business logic, as well as connectivity
to various components of our business applications). The same DLL is
also to be used with Project 2003. I've created the DLL as COM
Visible, and registered it properly - it works properly in Project
2003, which is what I've been using to test it (thinking that it would
work fine in Excel as well).
My problem is that now when I try to use the DLL from Excel XP, I get
an error on creating a "new" class from the DLL - and because of this,
I can't use any of the classes in the DLL.
For example:
--------------------------------------------------------
public sub tester()
{
dim x as myDLL.myTestClass 'Statement 1
set x = new myDLL.myTestClass 'Statement 2
}
--------------------------------------------------------
Statement 1 executes just fine - intellisense even figures out all the
class members (so if I were to start typing "x.testM", it would figure
out it was "x.testMethod").
Statement 2, however, I get an automation error on - without any
description:
--------------------------------------------------------
"Run-time error '-2146232576 (80131700)':
Automation Error
--------------------------------------------------------

The exact same sub, however, works without any problems at all in
Project 2003. Note that I don't use any Office Interop libraries (This

is a very simple class I created to test this problem, so it basically
has 1 method that sets the only variable in the class, and has a
default myTestClass() constructor), so I don't know why it doesn't work

in XP.
Would anyone be able to help me here? Have I somehow used a COM format

that doesn't work with XP? Does anyhow have an insight that can help?
Thank you in advance!
- Kurtis W. Story

May 10 '06 #1
2 7612
I'm confused because you said "VBA", but then your example sub didn't appear
to be VBA...

I use my C# assembly in VBA, but with the CreateObject statement; not "new"
(but perhaps you're using something newer than I am...)

Dim x as MyDLL.myTestClass
Set x = CreateObject("myDLL.myTestClass")

(I'm not an expert, but...) the other thing to look at would be whether you
can define your C# assembly as AutoDual, I recall about 1000 years ago
(programmer time) that we needed to do that with COM servers being used in
VB(A) script.

Bob
<te********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
[I've also asked this question in
microsoft.public.dotnet.languages.csharp, and
microsoft.public.excel.programming. If there is somewhere else that
may be able to help, please point me in the right direction!]

I've created a DLL in C# (VS2005, using .NET framework 2.0) for use
with Excel XP (to provide some business logic, as well as connectivity
to various components of our business applications). The same DLL is
also to be used with Project 2003. I've created the DLL as COM
Visible, and registered it properly - it works properly in Project
2003, which is what I've been using to test it (thinking that it would
work fine in Excel as well).
My problem is that now when I try to use the DLL from Excel XP, I get
an error on creating a "new" class from the DLL - and because of this,
I can't use any of the classes in the DLL.
For example:
--------------------------------------------------------
public sub tester()
{
dim x as myDLL.myTestClass 'Statement 1
set x = new myDLL.myTestClass 'Statement 2
}
--------------------------------------------------------
Statement 1 executes just fine - intellisense even figures out all the
class members (so if I were to start typing "x.testM", it would figure
out it was "x.testMethod").
Statement 2, however, I get an automation error on - without any
description:
--------------------------------------------------------
"Run-time error '-2146232576 (80131700)':
Automation Error
--------------------------------------------------------

The exact same sub, however, works without any problems at all in
Project 2003. Note that I don't use any Office Interop libraries (This

is a very simple class I created to test this problem, so it basically
has 1 method that sets the only variable in the class, and has a
default myTestClass() constructor), so I don't know why it doesn't work

in XP.
Would anyone be able to help me here? Have I somehow used a COM format

that doesn't work with XP? Does anyhow have an insight that can help?
Thank you in advance!
- Kurtis W. Story

May 12 '06 #2
Bob,

Thanks for the reply! I had been trying all of the definitions for the
assembly, but none of them worked. However, I found a solution to the
problem.

While I was not programming an Office "add-in, smart document, or smart
tag", I tried the solution here
http://support.microsoft.com/kb/908002/, and it was able to correct the
issue. This didn't come up when I tried to update Office through
Windows / Office update, which was strange, but now everything works
fine!

I did end up switching to AutoDual in the end, to make other parts work
nice, even though MS doesn't recommend that approach.

Thanks for the help!

- Kurtis W. Story

May 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific...
28
by: grahamd | last post by:
Who are the appropriate people to report security problems to in respect of a module included with the Python distribution? I don't feel it appropriate to be reporting it on general mailing lists.
5
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to...
2
by: malcolm | last post by:
Hello, We have a robust (.NET 1.1 c# winforms) client-server application that utilizes many typed DataSets, typed DataTables and typed DataRows. Our application is a series of windows and popup...
1
by: Aliandro | last post by:
Hi Does any one know where I can find information regarding any issues with SQL and IIS being run under windows XP SP2? as I am in the process of programmning in Dot net and neet some way of...
7
by: David Laub | last post by:
I have stumbled across various Netscape issues, none of which appear to be solvable by tweaking the clientTarget or targetSchema properties. At this point, I'm not even interested in "solving"...
2
by: G2 | last post by:
Hi We are dealing with significant browser compatibility issues with Netscape 5.x+ browsers and Mac IE. I am sure most web developers have faced similar issues in the past. Can anyone give me their...
1
by: GaryDean | last post by:
We have been developing all of our .net applications on 32 bit windows using 32 bit SQL Server. We are being asked to now deploy to servers running 64bit windows and 64bit SQL Server. Are there...
3
by: eschneider | last post by:
Just some common issues with WS: Using custom objects: When objects change, seems you are always fixing some issue. Update references, which sometimes does not work. Deployment: Weird errors...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.