473,320 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with excel.Range.NumberFormat

I am converting a VB6 app to VB.NET

The VB6 starts Excel to create a report.On several cells, the VB6 code does this:
rg._Default(1, 3).NumberFormat = "0.0000"
rg._Default(1, 3) = 140.95

When I open the report with excel, and right click on the cell, I can see that a "Personnalized format" has been added and is "0.0000". Works fine.
However the same code in VB.NET produces a "Personnalized format" = "0\.0000". A backslash has been added ? So the number in the cell is "0.0141" instead of "140.95".

Anybody knows why this \ is added ? And how to prevent this ?

Thanks!
Feb 17 '09 #1
1 9115
I replaced reference to "Microsoft.Office.Interop.Excel.CellFormat.NumberF ormat" to "Microsoft.Office.Interop.Excel.CellFormat.NumberF ormatLocal" and it solved the problem.
Feb 19 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: dudinissan | last post by:
Hello, I am writing c# web application. My code is: Excel.Application EXL; EXL = new Excel.Application(); Excel.Worksheet WSheet = new Excel.WorksheetClass(); string FileName = MapPath(".") +...
2
by: Jerry | last post by:
I am rewriting my vba routines to C# to increase speed. I have been unable to find any help on how to pass ranges to C#. Excel function that was called in VBA...
4
by: Jerry | last post by:
I am new to C# and have been trying to figure out how to access a range passed to C#. I have tried everything I can find and have been unable to get it to work. Here is a test sample Ive been...
0
by: aaj | last post by:
Hi I use the Excel 10 object library in one of my apps, and to read a range of cells I use : Excel.Range range = worksheet.get_Range(start,end); (System.Array)range.Cells.Value2; to read...
4
by: IMS.Rushikesh | last post by:
Hi All, I am trying to execute below code but it gives me an COMException ///// Code Start //// public string GetName(Excel.Range range) { try { if (range.Name != null)
2
by: George | last post by:
Is there a fast way to transfer an Excel range to an array? Example: Excel range is E2:E300 Dim person() as string Thanks, George
3
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C...
0
by: Franck | last post by:
Hi, Working with a Shared Addin (Autodual Class implementing the IdExtensibility2 interface), I'm just makin test in order to fill a range with values but get ComException Error when trying to set...
0
by: shantanu | last post by:
I am trying to convert a macro code to c# that will copy the values of a column and paste to anather through paste special. Everything is working fine but the transpose meathod to paste the column...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.