View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron West Ron West is offline
external usenet poster
 
Posts: 12
Default Yield() function missing from XL2007 SP1 ATPVBAEN Analysis Too

I have written a workaround, where I created a new Worksheet and allocated 8
named ranges along the top row (7 for the input parameters and 1 for the
result).

The 8th cell has this formula in

=YIELD(A1,B1,C1,D1,E1,F1,G1)

Then, if you add the following function and replace all VBA calls to Yield()
with Yield_Workaround() it seems to work OK now.
_____________

Function Yield_Workaround(SettlementDate As Date, MaturityDate As Date,
Rate, PR, Redemption, Frequency, Optional Basis = "") As Double
'Yield() function is not available in VBA for XL2007 SP1, only as a
function in a Worksheet

Range("Settlement").Value = SettlementDate
Range("Maturity").Value = MaturityDate
Range("Rate").Value = Rate
Range("PR").Value = PR
Range("Redemption").Value = Redemption
Range("Frequency").Value = Frequency
Range("Basis").Value = Basis

Range("WsFn_Yield").Calculate
Yield_Workaround = Range("WsFn_Yield").Value
End Function


"Bernard Liengme" wrote:

This appears to be a bug. I have reported it to the Excel Development Team
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Ron West" wrote in message
...
I have a spreadsheet that worked fine in XL2003 using the ATPVBAEN.XLA
Analysis ToolPak, but now that our local IT department have forced us all
to
"upgrade" to XL2007 SP1 it has stopped working because it can't find the
Yield() function from the new XL2007 ATPVBAEN.XLAM version of the ToolPak.

Using the Object Browser confirms that the function is no longer there.

However, if I deregister the new XLAM and register the old XLA file, the
Yield() function appears back in the Object Browser and the spreadsheet
compiles OK, BUT I now get unsolvable "Error 2015 - Type Mismatch" errors.

(After some Googling, I have tried to ensure the date format is correct
for
the first 2 parameters but the Error 2015 will not go away from the XL2007
run whatever I do).

Can anyone help?