M
Michael
According to the MS knowledge base it is possible to call
the Excel statistical functions from within Access. I am
interested in calling the TREND function (linear
regression). The difficulty I have is that the info
provided is a little short of detail on the specific
function I am interested in and object oriented
propramming is still a little new for me. What I want to
do is to pass two arrays and a single variable to TREND
and get back a result (in the same way it functions in
Excel) in the form TREND(array1,array2,var1). The code I
have written looks like this:
Function Trend()
Dim objExcel As Excel.Application
Dim Arg1(10), Arg2(10), constarg As Integer
constarg = Log(10)
For x = 1 To 10
Arg1(x) = x * 100
Arg2(x) = Log(x)
Next
Set objExcel = CreateObject("Excel.Application")
MsgBox objExcel.WorksheetFunction.Trend(Arg1, Arg2,
constarg)
objExcel.Quit
Set objExcel = Nothing
End Function
For the moment I have used arg1, arg2 and constarg as
dummy data, just to test the function. However I can't
get past error messages. The error message I get
is "Unable to get the Trend Property of the
WorkSheetFunction Class". I would be really grateful for
any advice or help
Cheers
the Excel statistical functions from within Access. I am
interested in calling the TREND function (linear
regression). The difficulty I have is that the info
provided is a little short of detail on the specific
function I am interested in and object oriented
propramming is still a little new for me. What I want to
do is to pass two arrays and a single variable to TREND
and get back a result (in the same way it functions in
Excel) in the form TREND(array1,array2,var1). The code I
have written looks like this:
Function Trend()
Dim objExcel As Excel.Application
Dim Arg1(10), Arg2(10), constarg As Integer
constarg = Log(10)
For x = 1 To 10
Arg1(x) = x * 100
Arg2(x) = Log(x)
Next
Set objExcel = CreateObject("Excel.Application")
MsgBox objExcel.WorksheetFunction.Trend(Arg1, Arg2,
constarg)
objExcel.Quit
Set objExcel = Nothing
End Function
For the moment I have used arg1, arg2 and constarg as
dummy data, just to test the function. However I can't
get past error messages. The error message I get
is "Unable to get the Trend Property of the
WorkSheetFunction Class". I would be really grateful for
any advice or help
Cheers