PC Review


Reply
Thread Tools Rate Thread

C# Value2 intermittent exception

 
 
temp@deltasero.com
Guest
Posts: n/a
 
      30th Dec 2006
I'm writing an app that has C# creating an Excel workbook.
I'm using the Value2 command to assign a range a value (typically a
string array).

Intermittently, on only some machines, and only some of the time, the
use of the Value2 command
will result in an exception. I then catch the exception and write the
cells one by one. This
has the unfortunate consequence of blowing up my construction time from
4 minutes to over 6 hours.

Any one have any experience with the Value2 command intermittently
failing.

TIA

TayBill

 
Reply With Quote
 
 
 
 
microsoft.public.excel.programming
Guest
Posts: n/a
 
      31st Dec 2006
Read all the way through the following link ... may be helpful ...

http://blogs.msdn.com/eric_carter/ar...06/225989.aspx


And then, embedded in the following is a small section on VALUE2 ...

http://msdn2.microsoft.com/en-us/library/aa192488(office.11).aspx

And the summary from the above article:

Summary
Microsoft Office Word and Microsoft Office Excel expose rich programming
models, but those object models were originally written to be consumed
by VBA clients. Visual Basic .NET, even with Option Strict On, can
handle most of the requirements of the Office object models. Consuming
those object models with C# requires a bit more care. When writing
applications using Visual Studio Tools for the Microsoft Office System
and C#, keep in mind that you'll often need to make concessions to the
differences between the languages, watching for optional parameters,
parameterized properties, Variants, and late binding. Once you
internalize the types of issues you'll face, writing C# code that
interacts with Office becomes no more difficult than writing Visual
Basic .NET code.


Good luck ...

JimP

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
temp@deltasero.com
Guest
Posts: n/a
 
      3rd Jan 2007
The following article has some discussion on why strings of a certain
size (912 chars or greater) will result in the Value2 command causing
an exception.

http://support.microsoft.com/kb/818808

The good news--this problem is NOT intermittent.

The bad news--part of my code had this as a repetitive problem. I
fixed this one.
I've got others (where the string length is NOT the problem) that
continue to fail (intermittently).



microsoft.public.excel.programming wrote:
> Read all the way through the following link ... may be helpful ...
>
> http://blogs.msdn.com/eric_carter/ar...06/225989.aspx
>
>
> And then, embedded in the following is a small section on VALUE2 ...
>
> http://msdn2.microsoft.com/en-us/library/aa192488(office.11).aspx
>
> And the summary from the above article:
>
> Summary
> Microsoft Office Word and Microsoft Office Excel expose rich programming
> models, but those object models were originally written to be consumed
> by VBA clients. Visual Basic .NET, even with Option Strict On, can
> handle most of the requirements of the Office object models. Consuming
> those object models with C# requires a bit more care. When writing
> applications using Visual Studio Tools for the Microsoft Office System
> and C#, keep in mind that you'll often need to make concessions to the
> differences between the languages, watching for optional parameters,
> parameterized properties, Variants, and late binding. Once you
> internalize the types of issues you'll face, writing C# code that
> interacts with Office becomes no more difficult than writing Visual
> Basic .NET code.
>
>
> Good luck ...
>
> JimP
>
> *** Sent via Developersdex http://www.developersdex.com ***


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Intermittent socket exception QDL Microsoft Dot NET Framework 4 27th Sep 2007 08:03 AM
Intermittent unhandled exception in WinForm app =?Utf-8?B?TWlrZSBBbG1vbmQ=?= Microsoft Dot NET Framework Forms 0 4th May 2007 04:59 PM
Exception from HRESULT: 0x800A03EC when setting string in Range.Value2 field amit.nayar@rivetsoftware.com Microsoft Excel Programming 1 15th Mar 2007 03:27 PM
Outlook 98 dr watson error exception c0000005 when receiving email - intermittent dan Microsoft Outlook Discussion 0 12th Aug 2004 11:03 PM
Intermittent exception Chris Kriel Microsoft ADO .NET 0 9th Jul 2003 08:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:34 PM.