Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Visual Studio Tools for Office
|
Visual Studio Tools for Office Be sure to specify which version you are working with.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio Tools for Office section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2009, 09:08 AM
Registered User
 
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Value = null for cell with numeric format General.

Hi,

I have a problem to get single numeric values from an Excel worksheet (that I need to process as I receive it).
I use the Microsoft Excel 9.0 Library because I need to process EXcel 2000/2003 files.
This is the range:

Excel.Range CellRange = (Excel.Range) WS.Cells[RowNum, ColNum];

I use this statement to check format and cell.

MessageBox.Show(CellRange.NumberFormat.ToString() + "\n" + RowNum.ToString() + "\n" + ColNum.ToString());

Only in case of format 0.0 I can get a value (e.g. 234.9) like this:

Result = Convert.ToDouble(CellRange.Value);
MessageBox.Show(Result.ToString());

But the format can also be General with values e.g. 234.9 (with point), 234,9 (with comma) or 2349 (without separator).
The value property is null for a cell with numeric format General.

It must be simple, but I can't find the solution.
Who can help me?

Thanks,
Gijs





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select date from cell with m/d/yyyy h:mm format mona_upm84 Excel VBA 2 August 10th, 2008 05:58 PM
Cell Accounting Format jcarey00 Excel VBA 1 September 28th, 2007 04:47 AM
numeric format for a textbox Rudner Beginning VB 6 1 November 9th, 2004 02:29 PM
format Table and Cell in XSL? bebe XML 2 November 13th, 2003 01:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.