Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I import an Office 2007 file into Office 2003? jeiacono Excel Discussion (Misc queries) 2 June 5th 08 03:15 AM
Updated to Office 2007 - Saving Excel file error Duane Excel Discussion (Misc queries) 1 April 14th 08 09:07 AM
Office 2007 compatibility pack on Office 2003 (slow network file fox_mulder33 Setting up and Configuration of Excel 0 January 2nd 08 03:28 PM
Opening an Office 2007 Excel file in Office 2003 charstachura Excel Discussion (Misc queries) 1 November 8th 07 09:36 PM


All times are GMT +1. The time now is 11:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"