Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
Difference between .value and .value2 DaveO Excel Programming 5 August 10th 06 12:13 PM
Merged cells Value2 property Sandrina Excel Programming 1 February 6th 06 02:58 PM
Lookup Value2 Len Excel Programming 11 April 17th 05 11:50 AM
scatter plots and "label" as ("X" value1, value2) shabnam Charts and Charting in Excel 3 April 11th 05 02:24 PM
Activecell.value or value2? Sirin Excel Programming 2 November 22nd 04 12:01 PM


All times are GMT +1. The time now is 11:13 PM.

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"