Hi,
I have a problem that I can now only attribute to Oxygene. Back in Elements 8.1.83.1751 I had no issue, but by Elements 10.0.0.2437 I do.
I’m using Microsoft.Office.Interop.Excel
to perform basic extract work. This has never been a problem, but after investigating some issues on user machines and thinking it was either OS versions, office DLL versions etc. I’ve now seen an error that has led me to think it is an Oxygene issue.
method MainForm.button1_Click(sender: System.Object; e: System.EventArgs);
var lExcelApp : Microsoft.Office.Interop.Excel.Application;
begin
lExcelApp := new Microsoft.Office.Interop.Excel.Application;
lExcelApp.Visible := true;
lExcelApp.Workbooks.Open(editFileName.Text);
end;
Working on the same development machine, if I run an oxygene project with the above code, I get an error whilst executing the Open
. If I run a C# project with the same code (below), the Open
is successful.
private void button1_Click(object sender, EventArgs e)
{
var lExcelApp = new Microsoft.Office.Interop.Excel.Application();
lExcelApp.Visible = true;
lExcelApp.Workbooks.Open(editFileName.Text);
}
The error returned in HRESULT : 0x800A03EC
I don’t think the error code is that relevant. In the production code the initial error I encountered was on the Workbooks.Add (below). Until upgrading RemObjects versions, this had worked, but now it doesn’t. I managed to work around that by using the version of add that specified the xlWBTATemplate parameter, but that then just led on to the next error which was effectively the one you see above i.e. an error opening a workbook.
lExcelApp := new Microsoft.Office.Interop.Excel.Application;
lExcelApp.SheetsInNewWorkbook := 1;
lDestWorkBook := lExcelApp.Workbooks.Add;
//lDestWorkBook := lExcelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
I have revisited the previous RemObjects version in an old development VM and the simple code above written in Oxygene continues to work. Given the old Elements version continues to work, my current one (10.0.0.2437) does not but a Microsoft C# version of the project does, them I’m left thinking this has to be a RemObjects bug ?