Hi Dave,
Thanks for your answer. It does work in Office 2000 and in 2003.
For this purpuse you need first to install the add-in "Analysis Tool Pack
VBA".
Once yo do this, you just call the function without the object:
var = Yield(par1, par2, par2, etc)
You may also need to check the
VB Tool/reference atpvbex.xls
Onthe other hand, under "Office 2007 differences"or "what's new" it says
that some Anlysis Tool Pack are now standard and those new functions are
listed. And of couse YIELD is one of them.
Try out PRICE function and it will work.
I have a small test.xls that runs under any version but of course, no Yield
function.
Rgds
Michel
"Dave Peterson" wrote:
I tested in xl2003 and Application.Price and Application.WorksheetFunction.Price
didn't work for me.
There are lots of excel functions that are not available through VBA's
worksheetfunction property.
(I wouldn't expect lots of changes between xl2003 and xl2007 for this kind of
thing.)
You do have a couple of other options...
You could use application.evaluate() or worksheets("somesheetname").evaluate()
or even plop the formula into an empty cell, calculate, retrieve the value, and
then clear that cell.
Michel Petit wrote:
Price and Yield are now part of standard functions in Excel-2007.
Application.WorksheetFunctions.Yield(7 pars) returns error: "Object does not
support method", when called from VBA code. I believe it shouldn't.
It works fine in the cell (=YIELD(...) ).
All others functions used (Price, Duration, MDudation) works fine from VBA.
I'm using Office-Pro-2007 60 days Trial, with SP1 included, Activated; to
update a 2000 and 2003 project for Office 2007 use.
Is this a bug? Is beacuse of Trial version? Some SP missing?
Thanks for any help.
--
Dave Peterson