Solved

VB.Net - Excel Formatting Issue From VB6 Conversion

Posted on 2013-02-04
7
191 Views
Last Modified: 2013-02-05
Good Day Experts!

I am having an issue when the formatting routine executes against the Excel spreadsheet that is created by this application. It is a VB6 program that I ran the conversion on.  I have not made any code changes to this formatting routine.  

Here is the line thatI am getting the error on:
If exlWS.Cells(x, 7) <> "" Then exlWS.Cells(x, 7) = CDec(exlWS.Cells(x, 7))

I attached the pop-up error message box.

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
  • 3
  • 3
7 Comments
 
LVL 27

Expert Comment

by:nmarun
ID: 38851557
I'm not seeing the attachment. Also let me know what data you are trying to convert to a decimal.

Arun
0
 

Author Comment

by:Jimbo99999
ID: 38851584
0
 
LVL 27

Accepted Solution

by:
nmarun earned 250 total points
ID: 38851599
Try
exlWS.Cells(x, 7).ToString <> ""

Arun
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:Jimbo99999
ID: 38851902
Ok, that got me past the first part and now on the ...Then exlWS.Cells(x, 7) = CDec(exlWS.Cells(x, 7)) I get an error:

Conversion from type 'Range' to type 'Decimal' is not valid.
0
 
LVL 27

Expert Comment

by:nmarun
ID: 38851939
Again, try CDec(exlWS.Cells(x, 7).ToString)

Arun
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 38854440
Either use ToString or use .Value

CDec(exlWS.Cells(x, 7).Value)
0
 

Author Closing Comment

by:Jimbo99999
ID: 38855506
Working now...thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question