Solved

VB.Net - Excel Formatting Issue From VB6 Conversion

Posted on 2013-02-04
7
188 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now