Solved

How to debug .Net Class Libraries being called from Excel VBA

Posted on 2014-04-15
2
454 Views
Last Modified: 2014-09-08
I have two .Net projects within a solution that have their Output Type as "Class Library".

I've run into a situation where one of these is failing when a method within the .Net class is called from Excel VBA.

I have the project properties for these two .Net solution both enabled for Register for COM-Interop.  I am able to load both References in Excel VBA by selecting the .tlb files.  I used REGASM from the command prompt on both .dll files just in case and they were registered successfully.

I need to debug this on the client machine, but without being able to step into the .Net code, I have no idea why it's failing, it's some type of run-time error, but I don't have a screenshot at this point.

I need to be able to debug the .Net Class Library on the client's machine from Excel VBA in order to step into the code.  These .Net Class Libraries are set as 2.0 .Net Framework.

How would you accomplish this?


Thanks
0
Comment
Question by:JMO9966
2 Comments
 
LVL 27

Assisted Solution

by:MacroShadow
MacroShadow earned 250 total points
ID: 40005089
You cannot debug an external dll in the visual basic editor.

Generally speaking you can't debug a compiled assembly, while it is possible to some extent with the aid of special debuggers, it would be a LOT easier to find out what the error is and then try to figure out where the error is triggered, you may even want to change your dll to show a message box telling you on which line the error occurred.
0
 
LVL 7

Accepted Solution

by:
Utkarsh Kulkarni earned 250 total points
ID: 40014441
As MacroShadow rightly said, you cannot debug an external dll in VB.

It is advised to write code to handle the error & either show in message box or log that error in log file (using NLog / log4net). This will be much better as log file can point error message, stack trace, source etc.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now