Incorporating Excel VBA code into a native C++ project (mixed assembly, VBA to visual basic migration, C++ interop)  
Author Message
Harmomelodic





PostPosted: Visual C++ General, Incorporating Excel VBA code into a native C++ project (mixed assembly, VBA to visual basic migration, C++ interop) Top

Good afternoon,

I have a bunch of Excel VBA code that I need to incorporate into my VS 2005 C++ project. As I have not done anything remotely like this before any help is appreciated.

The C++ project is a full windows application that processes a large amount of data; it generates .csv files that are loaded into excel upon which the VBA code is executed. This loop needs to be closed. I want to run the VBA code from within my multi-threaded C++ application.

The VBA code was developed independantly from my C++ code so the less I have to touch it the better. I relieze I will probably have to migrate the VBA code to visual basic for performance reasons and I have been reading about those differences (excel is totally unnecesary). I will also have to create a data interface between the C++ code and the VBA code so that I can pass the output of my C++ routines to the VBA code without saving to file and reloading them. I will probably need to redesign the data structures in the VBA code as part of that work since they are currently a mess (I hate inheriting code).

My C++ code relies heavily on STL and pointer manipulations. Modifying it so that is is CLR compliant is not an option. Rewriting the VBA code in native C++ is also not an option as the VBA code is extensive (an additional reason to migrate it to visual basic). I have done a great deal of C++ programming but I have hardly touched VBA or Visual Basic (I seem to be able to understand the code I read just fine, I just have not developed much on my own).

Do I have a nightmare on my hands I have been reading extensively for the last few days and I can't even figure out if I should use the VBA code to create an API to call from my C++ project or if I should fully incorporate it into the C++ project. Help me!

Thanks,

Chad




Visual C++11