Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error after chaging file access in Office 2007
Hi,
I use Office 2007 PIA's. I receive an exception in a very simple scenario: I open a 2007 xlsx file, set it to read only, and then set it back to XlFileAccess.xlReadWrite. After this I get an exception when trying to do anything with the workbook object. Strangely, I do not receive this exception when working with Office 2003 files (compatibility mode). Here is the code: try { app = new Application(); Workbook wb = app.Workbooks.Open(@"D:\Documents\Docs\Office 2007 Samples\2007.xlsx", 0, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true, Type.Missing, Type.Missing, false, Type.Missing, Type.Missing); wb.ChangeFileAccess(XlFileAccess.xlReadOnly, Missing.Value, false); wb.ChangeFileAccess(XlFileAccess.xlReadWrite, Missing.Value, false); //Exception when accesing anything on Workbook Console.WriteLine(wb.FullName); } catch (Exception exc) { Console.WriteLine(exc.ToString()); } Here is the detailed exception: System.Runtime.InteropServices.COMException (0x80010108): The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED)) at Microsoft.Office.Interop.Excel.WorkbookClass.get_F ullName() at TestConsoleApplication.Program.Main(String[] args) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I import an Office 2007 file into Office 2003? | Excel Discussion (Misc queries) | |||
Updated to Office 2007 - Saving Excel file error | Excel Discussion (Misc queries) | |||
Office 2007 compatibility pack on Office 2003 (slow network file | Setting up and Configuration of Excel | |||
Opening an Office 2007 Excel file in Office 2003 | Excel Discussion (Misc queries) |