Solved

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

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

20 Experts available now in Live!

Get 1:1 Help Now