Solved

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

Posted on 2014-04-15
2
463 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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