Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
C# Value2 intermittent exception
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
C# Value2 intermittent exception
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/lib...ffice.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 *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
C# Value2 intermittent exception
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/lib...ffice.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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Difference between .value and .value2 | Excel Programming | |||
Merged cells Value2 property | Excel Programming | |||
Lookup Value2 | Excel Programming | |||
scatter plots and "label" as ("X" value1, value2) | Charts and Charting in Excel | |||
Activecell.value or value2? | Excel Programming |