Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add does not work

Status
Not open for further replies.

Biznez

Technical User
Apr 9, 2015
106
CA
Hi, not sure why this is not adding. Substract, divide and multiply all work but does not add, instead it puts the numbers together

Trim(Sess0.Screen.GetString(12, 59, 10)) + Trim(Sess0.Screen.GetString(14, 39, 12))

thanks!
 
HI,

Convert both string values to integer or some other numeric type. The PLUS sign will concatenate strings, while it seems that the other operators will force a string to number conversion prior to performing the math.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
ahhhh ok this worked fine...Thanks again Skip!

WorksheetFunction.Sum(Trim(Sess0.Screen.GetString(12, 59, 10)), Trim(Sess0.Screen.GetString(14, 39, 12)))
 
Well, you posted in Attachmate, that has NOTHING to do with Excel, although you may be coding in VBA. In the Extra Basic editor you would...
Code:
CInt(Trim(Sess0.Screen.GetString(12, 59, 10))) + CInt(Trim(Sess0.Screen.GetString(14, 39, 12)))

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thanks skip, ill keep that in mind
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top