Hi everyone!

I have a program written in C++ which already exports some data to Excel, on the other hand, I have another program written in VBA to analyse the data. I used to run them independent but now I would like to simplify them.

Is there a chance to run the program written in VBA from C++???

Thanks

I would appreciate any info or help!

Carlos

They will remain separate programs, but I think you are asking if your C++ program can automatically run the VBA program so that the user doesn't have to?

You have a variety of options. You can use system() (#include <cstdlib>). system( "\"C:\\Program Files\\MyVBAProgram\\VBAProg.exe\"" ); On Windows you can use ShellExecuteEx() (there are examples on MS's site), and WaitForSingleObject() on the hProcess member of the SHELLEXECUTEINFO structure. (#include <windows.h>).

Or you can use CreateProcess() directly...

Hope this helps.

Duoas

Cheers for the quick reply!

I'll give it a shot!

I know the 2 programs will remain separate but I only wanted to link them.

Cheers again

Carlos

They will remain separate programs, but I think you are asking if your C++ program can automatically run the VBA program so that the user doesn't have to?

You have a variety of options. You can use system() (#include <cstdlib>). system( "\"C:\\Program Files\\MyVBAProgram\\VBAProg.exe\"" ); On Windows you can use ShellExecuteEx() (there are examples on MS's site), and WaitForSingleObject() on the hProcess member of the SHELLEXECUTEINFO structure. (#include <windows.h>).

Or you can use CreateProcess() directly...

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.