MartyConnelly
martyconnelly at shaw.ca
Tue Sep 13 02:12:51 CDT 2005
Here are two methods to get either general excel functions
or those in the financial anaylsis pack from access
Option Compare Database
Option Explicit
Function FindCeiling(pNumber As Double, pSignificance As Double)
Dim xl As Excel.Application
Dim varCeil As Variant
'general excel functions
Set xl = CreateObject("excel.application")
varCeil = xl.Application.Ceiling(pNumber, pSignificance)
FindCeiling = varCeil
End Function
Assuming the Financial Analysis Toolpak installed
Below is the code to get at the financial analysis toolpack's functions
for excel xla library. Not sure which xla library has ACCRINT.
'sample call
'?fLCM(24,36)
'
Function fLCM(intA As Integer, intB As Integer) As Integer
'Least Common Multiple of Integers
'set a reference to Excel object library
Dim objXL As Excel.Application
Set objXL = New Excel.Application
With objXL
If .AddIns("Analysis Toolpak").Installed Then
.Workbooks.Open (objXL.Application.LibraryPath & _
"\Analysis\atpvbaen.xla")
.Workbooks("atpvbaen.xla").RunAutoMacros (xlAutoOpen)
'intA and intB are parameters of call to LCM
fLCM = .Application.Run("atpvbaen.xla!lcm", intA, intB)
Else
fLCM = 0
MsgBox "Can't Find Analysis Toolpak atpvbaen.xla"
End If
End With
objXL.Quit
Set objXL = Nothing
End Function
Stuart McLachlan wrote:
>On 12 Sep 2005 at 18:53, Lonnie Johnson wrote:
>
>
>
>>Does anyone know how to convert or duplicate Excel's PMT and PPMT loan functions in MS Access?
>>
>>
>>
>
>How about using the PMT() and PPMT functions :-)
>
>They are in at least A2K and above at least and IIRC, they were in A97.
>
>
>
>
>
>
--
Marty Connelly
Victoria, B.C.
Canada