Calling Macros from Other Exe's

maneesh

New Member
Joined
Oct 28, 2002
Messages
5
I want to call a macro written in VBA
from a VC++ exe. The exe would pass an int array to the macro and the macro would read the array and fill a row in the excel sheet

Please let me know whether i could do this or is there and optimized way to to this

Please do provide me the Codes
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Oh sorry, I've misunderstood your Q. :biggrin:
Win32SDK yes? Here is a code execute external application and wait untill it will be finished.
So, execute excel itself from VisualC++, and why don't you write Auto_open code in the module of excel?
I have no idea except that...

<pre>
BOOL ExecuteAndWait(const CString &appPath, const CString &cmdLine)
{

CString cmdLine;
cmdLine.Format("%s %s",appPath,cmdLine);

char* commndLine=cmdLine.GetBuffer(cmdLine.GetLength());

STARTUPINFO infoStart;
PROCESS_INFORMATION infoProcess;

memset(&infoStart,0,sizeof(infoStart));
infoStart.cb=sizeof(STARTUPINFO);

BOOL res=CreateProcess(NULL,commndLine,NULL,NULL,FALSE,DETACHED_PROCESS,
NULL,NULL,&infoStart,&infoProcess);

if(res)
::WaitForSingleObject(infoProcess.hThread,INFINITE);
else
return FALSE;

return TRUE;

}
</pre>
 
Upvote 0

Forum statistics

Threads
1,214,388
Messages
6,119,226
Members
448,878
Latest member
Da9l87

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top