I don't understand the other part of your problem. What happens when you try
to update a worksheet? Unless the worksheet is protected, you should have
unrestricted access to the cells and ranges on the spreadsheet surface. Are
you getting exceptions?

Signature
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
>I see your point.
>
[quoted text clipped - 102 lines]
>>>>>
>>>>> Mark
Yes, sorry if that wasn't clear.
The exceptions come typically in 2 flavours.
One occurs if a cell or some other blocking operation is being edited. In
the case below I am updating some style information while a cell is being
edited. In this case I would expect to be able to determine it is in modal
state so I can take some other action.
System.Runtime.InteropServices.COMException (0x800A03EC): Exception from
HRESULT: 0x800A03EC.
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at Microsoft.Office.Interop.Excel.Range.set_Style(Object )
The other occurs it seems at times when the application is viewing the chart
and the underlying Worksheet is having data copied into it via a old ADO
RecordSet. This technique is the fastest waay to copy a significant amount
of data from c# into the excel workbook. I have checked all input variables,
the null object reference seems to be created inside the interop code. The
code does not fail all that often, only it seems when excel is busy doing
something.
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr,
Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture,
String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at Microsoft.Office.Interop.Excel.Range.CopyFromRecordset(Object Data,
Object MaxRows, Object MaxColumns)
Any suggestionson how to debug any of this?
Cheers and big ups in advance
>I don't understand the other part of your problem. What happens when you
>try to update a worksheet? Unless the worksheet is protected, you should
[quoted text clipped - 107 lines]
>>>>>>
>>>>>> Mark
Alvin Bruney - 26 Apr 2006 14:33 GMT
Excel is not built to support multiple concurrent users. As such, there is
no graceful means to handle concurrency except from exception triggers. I
suggest you wrap calls that you think will fail due to concurrency in an
exception block and have your code wait a while, using
System.Threading.Thread.Sleep(100) for instance, before trying again.

Signature
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Professional VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
> Yes, sorry if that wasn't clear.
>
[quoted text clipped - 149 lines]
>>>>>>>
>>>>>>> Mark