Solved

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

Posted on 2014-04-15
2
479 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

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…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…

710 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