My software is an excel plug-in. I need to do some unit-testing through Visual Studio ( debug mode ). We are using the C++ unit test framework embedded within Visual Studio.
Now, in my C++ test-code, when I open excel ( e.g. through shellexecute ), Excel opens up in a separate process and hence, I am not able to debug it in my debug process in Visual Studio. Moroever, related code gets executed in that process and not in my visual studio instance.
How do I attach to the excel programatically so that I can follow the behaviour in the debug mode of visual studio ?
It's a unit-test scenario and hence, we are trying to do everything with least manual intervention.
@ OP: What kind of errors are you looking for? Is it an option to just dump the data to a text file or something? If you're plug-in is crashing Excel then the data will be in Event Viewer.
@Computergeek01: Sorry for the terrible answer. I just assumed someone taking on debugging with Visual Studio would have the common sense to choose the appropriate forum. Buy hey, thanks for using italics: That shows you know how to emphasize without using bold -- quite the step up!
@TarikNeaj: I had my seconds -- I can't help it if you didn't find any.
Guys ... This is not about visual studio .. I am using visual studio for my development .. that's all .. and I know how to attach to a process and then debug using visual studio ..
You can say I want to do the same thing from C++ code directly. Open excel from my unit-test code but in the same process, so that my add-in code is also run in the same process and I am able to test it.
I could see we can have _Application, _Workbook objects there ... If I create a _workbook object in my test-code, will my add-in be loaded too, and the corresponding code run ??? Not tried yet.
If you're going to go that route then I can say from experience that it's much easier to use Interop with VBA then it is with C. Otherwise, at a glance at least, it looks like a valid solution to your issue.