Hi All....
I have a code variable name as cdNo which has the value:= 1.2+2.1+3.1
Now i want to convert this to decimal variable name decValue which should give me the result 6.4
I tried using EVALUATE but it gives the error as i can't enter + in decimal expression...Please help??
0
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
you have to split 1.2+2.1+3.1 into 3 variables like 1.2, 2.1 and 3.1
and add the 3
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
txt Code 20
excelauto Automation 'Microsoft Excel 12.0 Object Library'.Worksheet
xlApp Automation 'Microsoft Excel 12.0 Object Library'.Application
xlWorkBook Automation 'Microsoft Excel 12.0 Object Library'.Workbook
Dectest Decimal
Txt := '1.2+2.1+3.2';
create(xlApp);
xlWorkBook := xlApp.Workbooks.Add(-4167);
excelauto := xlApp.ActiveSheet;
excelauto.Range('A1').Value := '=' + txt;
Dectest := excelauto.Range('A1').Value;
xlWorkBook.Close(false);
message('%1',Dectest);
Try This..
Ex.
MSScriptControl.Language := 'VBScript';
decimalVar := MSScriptControl.Eval('(1+5+7+3) * 2');