adrianxw:
Here's the code section. The project is quite big, but I think it's well enough to see the errors, should there be any.
Code:
AnsiString tempstring;
tempstring=frmMunkadir->txtMunkadir->Text + "\\MotiFeldolgozó.xls" ;
tempint=tempstring.Length();
fileBuffer=new char[tempint];
for (int i=0;i<tempint; i++)
{
fileBuffer[i]=tempstring[i+1];
}
tempstring=frmMunkadir->txtMunkadir->Text;
tempint=tempstring.Length();
pathBuffer=new char[tempint];
for (int i=0;i<tempint; i++)
{
pathBuffer[i]=tempstring[i+1];
}
tempstring="/p " + frmMunkadir->txtMunkadir->Text;
tempint=tempstring.Length();
paramBuffer=new char[tempint];
for (int i=0;i<tempint; i++)
{
paramBuffer[i]=tempstring[i+1];
}
try
{ ShellExecute(
Handle,//HWND_DESKTOP, //Parent window
"open", //Operation to perform
fileBuffer, //Path to program
paramBuffer, //Parameters
NULL,//pathBuffer, //Default directory
SW_MAXIMIZE); //How to open
}
catch(...)
{
ShowMessage("Unable to open Excel!");
}
This is it. As you see there are some forms, and textboxes. Their path is absolutely okay.
Please take a look at it.
Thanks
Han