Recently an old project of .Net 1.1 is migrating to .Net4.0. The project is using the following method to open excel file:
Process process = new Process();
try
{
process.StartInfo.FileName = marco_file;
process.Start();
}
catch(Exception)
{
}
finally
{
process.Close();
}
And the marco_file is the path of excel file with macros, like "C:\project\test.xls" The macro in it will run immediately when the excel file open.
In .Net1.1 both the codes and the macro runs well. In .Net4, the codes runs without exceptions. But the macro didn't work.
Why the macro in the excel file didn't run?
My environment is Win7 64bit. Office 2010 64bit. IIS 7.5
Thanks
When I change to the following codes and run the debug mode
process.StartInfo.FileName = marco_file;
if (process.Start())
{
Debug.WriteLine("-->start ");
}
else
{
Debug.WriteLine("-->failed ");
}
The result is that it goes into the else block, which means the process fails to start.
Any one knows why?