User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 402,911 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,109 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 191 | Replies: 2
Reply
Join Date: Jul 2008
Posts: 3
Reputation: carlos_lopez_m is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
carlos_lopez_m carlos_lopez_m is offline Offline
Newbie Poster

C++ and VBA

  #1  
Jul 19th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,840
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 11
Solved Threads: 189
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: C++ and VBA

  #2  
Jul 19th, 2008
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.
Reply With Quote  
Join Date: Jul 2008
Posts: 3
Reputation: carlos_lopez_m is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
carlos_lopez_m carlos_lopez_m is offline Offline
Newbie Poster

Re: C++ and VBA

  #3  
Jul 19th, 2008
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


Originally Posted by Duoas View Post
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 3:55 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC