Here's what I dummied up at the command line. You just need to get the proper 
cells in the range object.

lox=CREATEOBJECT([excel.application])
lox.Visible=.t.
lox.Workbooks.Add()
los=lox.ActiveSheet
lor=los.Range([a1],[a10])
?lox.WorksheetFunction.Sum(lor)

--

rk
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, April 26, 2017 10:05 AM
To: [email protected]
Subject: Excel automation to get the SUM("R:R")

Excel 2013, VFP9SP2

Range Object model:   
https://msdn.microsoft.com/en-us/library/office/ff838238.aspx

I've got my handy "Microsoft Office Automation With Visual Foxpro" book 
out from HWP, trying to see where I can get the value of a range.  In 
this case, when I just select the entire column, Excel tells me the SUM 
of all of the values in the column at the bottom.  I need that number.  
I don't want to do some sort of loop; rather, I want to basically say 
from VFP: 'return the SUM("R:R").'  I've looked at the object model 
above and there doesn't appear to be a .Sum to tag onto the end of the 
Range object (like you might think of with DotNet stuff).  Also, I don't 
want to create a formula in some other remote cell and then read that, 
although that's my Plan B for now.

Ideas?

tia!
--Mike




[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/bn4pr10mb0913d36fc3e0f8011b08eb2bd2...@bn4pr10mb0913.namprd10.prod.outlook.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to