WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Execute Excel Function via OLE - COM


Question:

I need to use Excels SUMPRODUCT function in my OLE script. How do I accomplish this?

Answer:

I think the function only lives in Excel and you have to be communicating with Excel with an Excel spreadsheet to use the function. The 'Evaluate' method seems to be what your looking for.
var = 'SumProduct((RNG="books") * (REGION=6101) * (UNITS))'
;var = 'SumProduct((( RNG="books")+( RNG="pet")) * (REGION=6101) * (UNITS))'
nUnits = oXL.Evaluate(var)
Note: 'evaluate' appears nowhere in the Excel Help file. It appears 'evaluate' method functions at both the application and worksheet level and will work on strings up to 256 chars).
Article ID:   W16621
File Created: 2005:02:18:12:21:38
Last Updated: 2005:02:18:12:21:38