Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default C# VBA DLL issues

[This question may belong in another group (some sort of .NET or C#
group). If it does, 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default C# VBA DLL issues

Hi Kurtis,

I'm no interop expert, but here's a thread that may or may not help you:

http://forums.microsoft.com/MSDN/Sho...53976&SiteID=1

I'd try another group if this doesn't help (maybe
microsoft.public.dotnet.framework.interop).
--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


Temporalis wrote:
[This question may belong in another group (some sort of .NET or C#
group). If it does, 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default C# VBA DLL issues

Thanks for the reply Jake.

That thread did give me new ideas to try. However, none of them worked
:(. I've posted in some other groups, and if I get a reply that fixes
the problem post it here so anyone looking here can find it.

An update on what I've tried:
Uninstalling Microsoft Project 2003 did not correct the issue.
Compiling under Visual Studio 2003 did not help.
Compiling under Visual Studio 6.0 did not help.
Creating wrapper objects in Visual Basic .NET, 2003, and 6.0 did not
help (it works fine until it gets into Office).
Different settings and methods of exposing the classes and methods (as
shown here
http://forums.microsoft.com/MSDN/Sho...53976&SiteID=1)
did not work.

I suspect now that the issue has to do with the framework - perhaps
Office XP cannot load the .NET 2.0 Framework? Or perhaps it defaultly
loads the 1.1 Framework, and can not load the 2.0 Framework? I've
still got to track down a copy of Excel 2003 (the tech guy's out
today), and see if it is able to run the DLL, showing for sure if the
issue is with the DLL or with Office.

Thanks again for your help Jake!

- Kurtis W. Story

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default C# VBA DLL issues

No problem, Kurtis. The post I thought may help you was this one:

<quote
OK. I figured out the problem
The class I am using for interop inherits from an abstract class.
I did not have the abstract class decorated with the interop attributes.
Before I installed the 2.0 framework this was all fine and it worked just
fine. However, once I installed 2.0 I got the automation error.
So to make the automation error go away all I had to do is decorate the
abstract class.
</quote

Does that situation apply to you? If so, did you try the suggestion
(decorate the abstract class with interop attr)?

Good luck - hope you find a solution.

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

Temporalis wrote:
Thanks for the reply Jake.

That thread did give me new ideas to try. However, none of them
worked :(. I've posted in some other groups, and if I get a reply
that fixes the problem post it here so anyone looking here can find
it.

An update on what I've tried:
Uninstalling Microsoft Project 2003 did not correct the issue.
Compiling under Visual Studio 2003 did not help.
Compiling under Visual Studio 6.0 did not help.
Creating wrapper objects in Visual Basic .NET, 2003, and 6.0 did not
help (it works fine until it gets into Office).
Different settings and methods of exposing the classes and methods (as
shown here
http://forums.microsoft.com/MSDN/Sho...53976&SiteID=1)
did not work.

I suspect now that the issue has to do with the framework - perhaps
Office XP cannot load the .NET 2.0 Framework? Or perhaps it defaultly
loads the 1.1 Framework, and can not load the 2.0 Framework? I've
still got to track down a copy of Excel 2003 (the tech guy's out
today), and see if it is able to run the DLL, showing for sure if the
issue is with the DLL or with Office.

Thanks again for your help Jake!

- Kurtis W. Story



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default C# VBA DLL issues

Jake,

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!

Thanks for the help!

- Kurtis W. Story



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default C# VBA DLL issues

Hi Kurtis

I had the same problem & solved it the same way... however, when I
deploy the c# dll on a client machine (no VS2005, but NET 2.0
installed)& run regasm w codebase flag & re-generate the tlb, I get that
error message... any ideas?

cheers
spin



*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues with dates JS Excel Discussion (Misc queries) 1 August 3rd 06 05:09 PM
Fill Issues Kaziglu Bey Excel Discussion (Misc queries) 7 July 6th 06 05:28 AM
protection issues . . . HELP! Wayne Knazek Excel Discussion (Misc queries) 3 July 5th 06 09:31 PM
need help for several issues bandy2000 Excel Programming 2 March 15th 05 02:11 AM
XLA Link Issues MikeC[_2_] Excel Programming 0 November 14th 03 06:34 PM


All times are GMT +1. The time now is 12:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"