0

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

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by carlos_lopez_m
0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.